用户工具

站点工具


php_编译指南

PHP 编译指南

编译安装在原则上参考UNIX 环境编译指南中的描述进行。由于 PHP 不易编译,这里提供一些指导性意见。

注意事项

PHP 的依赖较多,基本不会出现一次 configure 就执行通过的情况。请按照提示,安装上必要的依赖包,重新尝试编译。

Configure

Solaris 11

Under Solaris 11, those packages are to be installed:

$ pfexec pkg install gd mysql-51/library
$ export CFLAGS='-I/usr/mysql/include -L/usr/mysql/lib/mysql'
$ export CXXFLAGS='-I/usr/mysql/include -L/usr/mysql/lib/mysql'
$ export LDFLAGS="-L/usr/mysql/lib/mysql"

(Remember that libmysql provided by Solaris 11 is 32-bit)

And configure with

./configure --bindir=/usr/php/5.3/bin --datadir=/usr/php/5.3/share --exec-prefix=/usr/php/5.3 --includedir=/usr/php/5.3/include --libdir=/usr/php/5.3/lib --libexecdir=/usr/php/5.3/modules --mandir=/usr/php/5.3/man --oldincludedir=/usr/php/5.3/share --prefix=/usr/php/5.3 --sbindir=/usr/php/5.3/sbin --sysconfdir=/etc/php/5.3 --with-config-file-path=/etc/php/5.3 --with-config-file-scan-dir=/etc/php/5.3/conf.d --with-exec-dir=/usr/php/5.3/bin --disable-debug --with-cdb --disable-dmalloc --enable-shared --enable-fpm --enable-cli --enable-bcmath --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-flatfile --enable-filter --enable-gd-native-ttf --enable-hash --enable-inifile --enable-json --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-pcntl --enable-posix --enable-libxml --enable-sqlite-utf8 --enable-session --enable-shmop --enable-short-tags --enable-simplexml --enable-zip --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-sqlite=shared --with-zlib --with-pear --with-mysql=/usr/mysql --with-mysql-sock --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-curl=/usr

Alternatively, you can download libmysql from MySQL website, install it in /usr/local/mysql, and configure with

CFLAGS=-m64
CXXFLAGS=-m64
./configure --bindir=/usr/php/5.3/bin --datadir=/usr/php/5.3/share --exec-prefix=/usr/php/5.3 --includedir=/usr/php/5.3/include --libdir=/usr/php/5.3/lib --libexecdir=/usr/php/5.3/modules --mandir=/usr/php/5.3/man --oldincludedir=/usr/php/5.3/share --prefix=/usr/php/5.3 --sbindir=/usr/php/5.3/sbin --sysconfdir=/etc/php/5.3 --with-config-file-path=/etc/php/5.3 --with-config-file-scan-dir=/etc/php/5.3/conf.d --with-exec-dir=/usr/php/5.3/bin --disable-debug --with-cdb --disable-dmalloc --enable-shared --enable-fpm --enable-cli --enable-bcmath --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-flatfile --enable-filter --enable-gd-native-ttf --enable-hash --enable-inifile --enable-json --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-pcntl --enable-posix --enable-libxml --enable-sqlite-utf8 --enable-session --enable-shmop --enable-short-tags --enable-simplexml --enable-zip --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-sqlite=shared --with-zlib --with-pear --with-mysql=/usr/local/mysql --with-mysql-sock --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-curl=/usr

to get 64-bit binary.

Solaris 10 / Linux

./configure --bindir=/usr/php/5.3/bin --datadir=/usr/php/5.3/share --exec-prefix=/usr/php/5.3 --includedir=/usr/php/5.3/include --libdir=/usr/php/5.3/lib --libexecdir=/usr/php/5.3/modules --mandir=/usr/php/5.3/man --oldincludedir=/usr/php/5.3/share --prefix=/usr/php/5.3 --sbindir=/usr/php/5.3/sbin --sysconfdir=/etc/php/5.3 --with-config-file-path=/etc/php/5.3 --with-config-file-scan-dir=/etc/php/5.3/conf.d --with-exec-dir=/usr/php/5.3/bin --disable-debug --with-cdb --disable-dmalloc --enable-shared --enable-fpm --enable-cli --enable-bcmath --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-flatfile --enable-filter --enable-gd-native-ttf --enable-hash --enable-inifile --enable-json --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-pcntl --enable-posix --enable-libxml --enable-sqlite-utf8 --enable-session --enable-shmop --enable-short-tags --enable-simplexml --enable-zip --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-sqlite=shared --with-zlib --with-pear --with-mysql --with-mysql-sock --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-curl=/usr

Installation

直接 make, make install 即可。

配置

php_编译指南.txt · 最后更改: 2011/11/13 17:39 由 admin