Home >Backend Development >PHP Problem >How to install gd extension in php

How to install gd extension in php

藏色散人
藏色散人Original
2020-07-08 09:32:305379browse

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.

How to install gd extension in php

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 visit PHP中文网!

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