获得最新版本的 Apache 和 PHP。
将它们的 tar 包解压,然后如下运行 Apache 的 configure 程序。
./configure --exec-prefix=/usr \ --localstatedir=/var \ --mandir=/usr/share/man \ --libexecdir=/System/Library/Apache/Modules \ --iconsdir=/System/Library/Apache/Icons \ --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \ --enable-shared=max \ --enable-module=most \ --target=apache |
如果想对编译做些优化,可以添加下面一行:
setenv OPTIM=-O2 |
接下来,进入 PHP 4 源代码目录,并进行 configure 操作。
./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/share/man \ --with-xml \ --with-apache=/src/apache_1.3.12 |
输入 make 和 make install。这样在 Apache 源代码目录中会创建一名为 src/modules/php4 的目录。
现在,重新配置 Apache 以编译 PHP 4。
./configure --exec-prefix=/usr \ --localstatedir=/var \ --mandir=/usr/share/man \ --libexecdir=/System/Library/Apache/Modules \ --iconsdir=/System/Library/Apache/Icons \ --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \ --enable-shared=max \ --enable-module=most \ --target=apache \ --activate-module=src/modules/php4/libphp4.a |
从 PHP 4 源代码目录复制并重命名 php.ini-dist 文件到 bin 目录:cp php.ini-dist /usr/local/bin/php.ini 或(如果没有 local 目录)cp php.ini-dist /usr/bin/php.ini。