How to install gd extension in php: first install the relevant dependencies; then install the gd extension through the "make install" command; then open the "php.ini" file and add a line of "gd.so"; finally restart "php- fpm" service.
PHP installation gd extension
The first step is to install dependencies
1. Install xpm
yum install libXpm-devel
2. Install zlib
wget http://zlib.net/zlib-1.2.8.tar.gz tar -xzvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make && make install make clean && make distclean cd ../
3. Install libjpeg jpeg-9b
wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz tar -xzvf jpegsrc.v9b.tar.gz cd jpegsrc.v9b ./configure \ --prefix=/usr/lib64 \ --enable-shared \ --enable-static make && make instll make clean && make distclean libtool --finish /usr/local/jpeg/lib cd ../
4 , install libpng
yum install libpng libpng-devel
5, install freetype2
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.7.tar.gz tar -xzvf freetype-2.7.tar.gz cd freetype-2.7 ./configure \ --prefix=/usr/lib64 make && make install make clean && make distclean cd ../
The second step is to install gd extension
$ cd [php安装目录] $ cd ext/gd $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-png-dir --with-freetype-dir --with-jpeg-dir --with-gd $ make $ make install
After successful installation, return to the installation location of gd:
Installing shared extensions: /alidata/server/php-5.5.38/lib/php/extensions/no-debug-non-zts-20121212/
The third step is to enable the gd extension
Then open /alidata/server/php-5.5.38/etc /php.ini
Add a line near
;extension=/path/to/extension/msql.so
extension=/alidata/server/php-5.5.38/lib/php/extensions/no-debug-non-zts-20121212/gd.so
Finally restart the php-fpm service
For more related knowledge, please visitPHP中文网!
The above is the detailed content of How to install gd extension in php. For more information, please follow other related articles on the PHP Chinese website!