We often run into the compiler after the installation of PHP and then remembered to add an extension, the last time our company's PHP encountered a situation like this, We upgraded PHP from 5.3.3 to 5.6.8, and then recompile, 5.6.8 installation is complete, but they do not have the GD Library of PHP, can not identify the verification code, then my egg hurts, can only continue to install the extension. But for a moment to forget how to install the extension, re-download a gd.tar.gz source code compilation is not good, fortunately later found their own documents, and now this method is posted for reference later.
PHP Extract Directory/data/php-5.6.8php installation directory/data/install/php
Installing GD extensions
Before the installation of GD to install a few other packages, or the GD library compile time will be error, if you have installed a few other packages, you can omit the following 1, 2 steps, if there are errors can be based on the error prompt to repair
① installation FreeType [root@test ~]# tar xzvf/data/install/freetype-2.4.0.tar.gz [root@test ~]# cd/data/install/ freetype-2.4.0 [root@test ~]# make && make install ② install JPEG [root@test ~]# tar xzvf/data/install/ jpegsrc.v6b.tar.gz [root@test ~]# cd/data/install/jpeg-6b [root@test ~]# make && make install ③ Install GD [root@test ~]# cd/data/install/php-5.6.8 [root@test php-5.6.8]# CD ext/gd/
The default is no configure, we need to execute the phpize command in the installation directory of PHP [root@test_qx_web gd]#/data/install/php/bin/phpize The Configure [Root@test gd]#./configure--with-php-config=/data/install/php/bin/php-config will not appear until this command is executed. --with-png-dir--with-freetype-dir--with-jpeg-dir--with-gd [Root@test gd]# make && make install [root@test gd]# echo "extension = gd.so" >>/data/install/php/etc/ PHP.ini [root@test gd]# service php-fpm restart
2. Installing the Redis extension [root@test ~]# tar zxvf redis-2.2.7.tgz [root@test ~]# cd redis-2.2.7 [Root@test ~]# /usr/local/php/bin/phpize [Root@test ~]#./configure--with-php-config=/data/install/php/bin/php-config [root@test ~]# make && Make install [root@test ~]# echo "extension = redis.so" >>/data/install/php/etc/php.ini [Root@test ~]# Service PHP-FPM Restart
The above is my installation of GD and Redis extension process, the basic compilation after PHP to append the extension is basically this step.