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

How to install gd extension in php

藏色散人
Release: 2023-03-02 07:28:02
Original
5410 people have browsed it

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
Copy after login

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 ../
Copy after login

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 ../
Copy after login

4 , install libpng

yum install libpng libpng-devel
Copy after login

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 ../
Copy after login

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
Copy after login

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/
Copy after login

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
Copy after login

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template