下载源代码到 src 目录并解压:
# cd /usr/local/src
# wget
# tar -xjf php-5.3.6.tar.bz2
配置安装参数
./configure --build=i686-RedHat-linux-gnu --host=i686-redhat-linux-gnu \ --target=i686-redhat-linux-gnu --with-apxs2=/usr/sbin/apxs \ --prefix=/usr/local --exec-prefix=/usr/local --with-exec-dir=/usr/local/bin \ --sysconfdir=/etc --libdir=/usr/local/lib/php --with-libdir=lib \ --sbindir=/usr/local/sbin --sharedstatedir=/usr/com --datadir=/usr/local/share \ --includedir=/usr/local/include --libexecdir=/usr/local/libexec \ --localstatedir=/var --cache-file=../config.cache \ --mandir=/usr/local/share/man --infodir=/usr/local/share/info \ --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d \ --with-pic --with-curl=shared --with-freetype-dir --with-png-dir \ --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-png-dir \ --with-openssl --with-layout=GNU --with-libxml-dir \ --with-pcre-regex=/usr \ --with-mcrypt=shared --with-mhash --with-zlib --with-bz2=shared \ --with-pdo-mysql --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-pgsql --with-pdo-pgsql --with-sqlite=shared --with-pdo-sqlite=shared \ --enable-sqlite-utf8 --with-kerberos --with-imap --with-imap-ssl \ --with-pear --with-gd --enable-gd-native-ttf --enable-calendar=shared \ --enable-exif --enable-ftp --enable-sockets --enable-bcmath \ --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-intl \ --enable-mbstring --enable-zend-multibyte --enable-zip \ --without-unixODBC --disable-tokenizer \非RHEL/CentOS系统可以省略 --build,--host,--target 参数,程序会自动判断(LINUX一般为i686-pc-linux-gnu)。如果没安装pgsql或者不需要pgsql的支持可以删除相关参数(共2个)。 bz2, calendar, curl, mcrypt, pdo_sqlite, sqlite 这些模块采用动态编译,可采用下面将会提到的方法加载。