Step 1:
Install the required libraries
yum -y install libjpeglibjpeg-devel libpng libpng-devel freetype freetype-devel
Step 2:
Enter the ext/gd directory under the source code directory of PHP (This is the source code directory, not the installation directory, please pay attention to the difference)
1. First execute: {$php_indtall_dir}/bin/phpize
Note: {$php_indtall_dir} here refers to the installation directory of php. If it is installed to / usr/local/php, then execute /usr/local/php/bin/phpize, here is where the .configure compiled file is generated
2. Execute: ./configure --with-png-dir --with-freetype -dir --with-jpeg-dir --with-gd --with-php-c/local/php/bin/php-config
Note: The --with-php-config directory here is based on your own PHP installation Path configuration
3. Execute: make && make install
Step 3: Modify php.ini
Add: extension=gd.so
Step 4:
Restart php-rpm, and then restart nginx or apache, here you can see that the php_info page has a gd extension^_^
Without this library, the verification of your website cannot be displayed!
The above introduces the gd extension for php under centos, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.