After installing php extensions, we often encounter the need to add extensions after compiling and installing php. The last time our company encountered such a situation, we upgraded php from 5.3.3 to 5.6.8, then re-compile and install 5.6.8. but they say that there is no gd Library and the verification code cannot be identified. so I am so tired that I can only continue to install the extension. However, I forgot to install the extended idea and re-download the source code compilation of gd.tar.gz. Fortunately, I found my own document. now I will post this method for reference later.
Php unzip directory/data/php-5.6.8php installation directory/data/install/php
Install gd extension
Install several other packages before installing gd. Otherwise, an error will be reported during gd Library compilation. if you have installed several other packages, skip steps 1 and 2 below, if an error is reported, follow the error prompt to fix it.
① Install 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/mongosrc.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/
No configure by default, run the phpize command [root @ test_qx_web gd] #/data/install/php/bin/phpize command in the php installation directory before the configure [root @ test gd] #. /configure -- with-php-config =/data/install/php/bin/php-config -- 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. install 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 the process of installing the gd and redis extensions. it is basically this step to append the extensions after php is basically compiled.