Leopard 编译 universal php5
Posted in Bsd, MacosX, Unix, bash, php by Kafeifei on the 12月 11th, 2007
因为自带的php没有gd所以要重编
因为服务器用的是x86_64 httpd+php5所以要编 x86_64
因为自带的httpd+php是 universal ,所以要这样做
自带的httpd很好,所以不搞它了
参考:
ppc就不要了
export MACOSX_DEPLOYMENT_TARGET=10.5
export ARCHFLAGS='-arch i386 -arch x86_64'
export CFLAGS='-arch i386 -arch x86_64 -O3 -pipe'
export CXXFLAGS='-arch i386 -arch x86_64 -O3 -pipe'
export LDFLAGS='-arch i386 -arch x86_64 -bind_at_load'
make时候可能出现这样的提示:
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
在 configure 的时候加上 --disable-dependency-tracking
'./configure' \
'--prefix=/usr' \
'--with-config-file-path=/private/etc' \
'--sysconfdir=/private/etc' \
'--with-apxs2=/usr/sbin/apxs' \
'--with-iconv=/usr/local' \
'--with-mhash=/usr/local' \
'--with-gettext=/usr/local' \
'--with-mysql=/usr/local' \
'--with-mysqli=/usr/local/bin/mysql_config' \
'--with-pdo-mysql=/usr/local' \
'--with-openssl=/usr' \
'--with-zlib=/usr' \
'--with-curl=/usr' \
'--with-gd' \
'--with-png-dir=/usr/X11' \
'--with-jpeg-dir=/usr/local' \
'--with-freetype-dir=/usr/X11' \
'--with-xpm-dir=/usr/X11' \
'--enable-gd-native-ttf' \
'--enable-mbstring' \
'--enable-sockets' \
已有的库就不重装了,只需自己安装 gawk, libiconv, mhash, gettext, mysql, jpeg
需要特别注意:系统自带的liviconv有问题,需要自己编一份到/usr/local(小心不要覆盖以前的,否则可能连sh都不能执行了),php在configure时就算指定了 --with-iconv=/usr/local 它还是首先找到 /usr/include/iconv.h ,而且 --help 里只提到 --with-iconv-dir=,应该使用 --with-iconv=
解决方法:
sh#mv /usr/include/iconv.h /usr/include/iconv.h.bak
» Filed Under Bsd, MacosX, Unix, bash, php
Comments
One Response to “Leopard 编译 universal php5”
Leave a Reply
[...] 有关如何在64bit Mac OS X Leopard下面重新编译PHP并添加自己需要模块的文章请参考Leopard 编译 universal php5 [...]