./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-mysql --with-apxs2=/usr/local/apache/bin/apxs
./configure --prefix=/usr/local/php --with-mysql=/usr/local/webserver/mysql --enable-force-cgi-redirect --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gdbm --with-gettext --with-iconv --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib
#mysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。
make ZEND_EXTRA_LIBS='-liconv'
make install
参数说明:
--prefix=/usr/local/php //指定 php 安装目录
--with-apxs2=/usr/local/apache/bin/apxs //整合apache,apxs功能是使用mod_so中的LoadModule指令,加载指定模块到 apache,要求 apache 要打开SO模块
--with-config-file-path=/usr/local/php/etc //指定php.ini位置
--with-MySQL=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config
--enable-safe-mode
--enable-ftp
--enable-zip
--with-bz2
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--without-iconv
--with-libXML-dir
--with-XMLrpc
--with-zlib-dir
--with-gd
--enable-gd-native-ttf
--with-curl
--with-curlwrappers
--with-ttf
--with-xsl
--with-gettext
--with-pear
--enable-calendar
--enable-mbstring
--enable-bcmath
--enable-sockets
--enable-exif
--enable-magic-quotes
--disable-rpath
--disable-debug
--with-mime-magic=/usr/share/file/magic.mime
CGI方式安装才用的参数:
--enable-fpm //打上PHP-fpm 补丁后才有这个参数,CGI方式安装的启动程序
--enable-fastCGI //支持fastcgi方式启动PHP
--enable-force-CGI-redirect //重定向方式启动PHP
--with-ncurses //支持ncurses 屏幕绘制以及基于文本终端的图形互动功能的动态库
--enable-pcntl
--with-mcrypt
--with-mhash
--with-gmp
--enable-inline-optimization
--with-openssl
--enable-dbase
--with-pcre-dir=/usr/local/bin/pcre-config
--disable-dmalloc
--with-gdbm
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap
1>指定了--with-apxs2=/usr/local/apache/bin/apxs以后,就不要再激活--enable-fpm和--enable-fastCGI,apxs是以php module的模式加载PHP的。
2>Mysql在编译了Mysql开发library以后,可以不用指定mysql的路径。
3>PHP编译存在基础的依赖的关系,编译PHP首先需要安装XML扩展,因为php5核心默认打开了XML的支持,其他的基础库,相应需要:
4>GD -> zlib, Png, Jpg, 如果需要支持其他,仍需要根据实际情况编译扩展库,ttf库需要freetype库的支持。
5>--enable-magic-quotes,是一个极其不推荐的参数,当然,如果你需要PHP为你做这些底下的工作,实际上他也没有很彻底的解决问题。
6>-with-openssl,需要openssl库。
php.ini set :
AddType application/x-httpd-php .php .phtml
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#