php5.2
./configure --prefix=/usr/local/php-5.2.14 -with-config-file-path=/usr/local/php-5.2.14/etc -with-mysql=/usr/bin/mysql -with-mysqli=/usr/bin/mysql_config -with-openssl -enable-fpm -enable-mbstring -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib-dir -with-libxml-dir=/usr -enable-xml -with-mhash -with-mcrypt -enable-pcntl -enable-sockets -with-bz2 -with-curl -with-curlwrappers -enable-mbregex -with-gd -enable-gd-native-ttf -enable-zip -enable-soap -with-iconv -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-ldap -with-ldap-sasl -enable-pdo -with-pdo-mysql -enable-force-cgi-redirect -enable-cgi -with-libdir=lib64 -enable-fastcgi
php-fpm 需要--enable-cgi --enable-fpm 两个参数,上面参数的顺序也很重要,否则configure过不去。
如果是64位系统configure需要加上参数--with-libdir=lib64,否则很可能会缺少库文件,例如:
php configure error libjpeg.(a so) not found
编译链接的时候可能出现问题,比如 /usr/bin/ld: cannot find -lltld,缺少/usr/lib/libltdl.so,添加epel源,yum install libtool-ltdl-devel就可以了,之后make clean重新编译就OK了。
这种方式安装的扩展都是集成到php.exe中的。
php5.4
./configure --prefix=/opt/local/php-5.4.44 -with-config-file-path=/opt/local/php-5.4.44/etc -with-mysql=mysqlnd -with-mysqli=mysqlnd -enable-ftp -with-openssl -enable-fpm -enable-mbstring -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib-dir -with-libxml-dir=/usr -enable-xml -with-mhash -with-mcrypt -enable-pcntl -enable-sockets -with-bz2 -with-curl -with-curlwrappers -enable-mbregex -with-gd -enable-gd-native-ttf -with-gettext -enable-zip -enable-soap -with-iconv -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-ldap -with-ldap-sasl -enable-pdo -with-pdo-mysql -enable-cgi -with-libdir=lib64
zts版本增加 --enable-maintainer-zts
依赖库:
yum install libxml2-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libmcrypt-devel mhash-devel mysql-devel libtool-ltdl-devel