Home  >  Article  >  Backend Development  >  How to install gd extension in php

How to install gd extension in php

王林
王林Original
2020-10-29 17:36:462962browse

How to install gd extension in php: 1. Enter the php installation directory; 2. Execute the [/usr/local/php/bin/phpize] command; 3. Execute the [make && make install] command to compile and install.

How to install gd extension in php

The first step is to install dependencies

(Video tutorial recommendation: php video tutorial)

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.gztar -xzvf jpegsrc.v9b.tar.gz
cd jpegsrc.v9b
./configure \--prefix=/usr/lib64 \--enable-shared \--enable-staticmake && 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.gztar -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 the 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 the installation is successful, 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 gd extension

Then open /alidata/server/php-5.5.38/etc/php.ini

in

;extension=/path/to/extension/msql Add a line near .so

extension=/alidata/server/php-5.5.38/lib/php/extensions/no-debug-non-zts-20121212/ gd.so

Finally restart the php-fpm service

Related recommendations:php training

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn