Home >Backend Development >PHP Tutorial >PHP source code installation does not have the gd library
The GD library added by general source code installation does not support images in jpeg format. It only supports the following formats
GD Support enabled
GD Version bundled (2.0.34 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
libPNG Version 1.2.49
WBMP Support enabled
XBM Support enabled
Let’s add support for jpeg format files
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
tar -zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make && make install
Enter the php source code directory below The gd directory under ext
Enter the gd directory and execute Note that /usr/local/php/ below is the installation path of your server php. Mine is the path written like this
/usr/local/php/bin/phpize
./configure --with-php-c/local/php/bin/php-config --with-jpeg- dir=/usr/local/jpeg/
make && make install
After executing these, the system will prompt you to generate the gd.so directory
Add gd.so under php.ini and restart php. Restart the application server and it will be OK.
Some machines may not work, this is the solution
yum install libjpeg-devel freetype-devel libpng-devel
make clean and then re./configure
make&make install
Check phpinfo OK
GD Support enabled
GD Version 2.0
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version unknown
PNG Support enabled
libPNG Version 1.2.10
WBMP Support enabled
GD Support enabled
GD Version bundled (2.0.34 compatible)
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.2.49
WBMP Support enabled
XBM Support enabled
Directive Local Value Master Value
gd.jpeg_ignore_warning 0 0
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the PHP source code installation without the gd library, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.