任何人都可以指导我或写下他们在 Snow Leopard 上安装 Apache 和 PHP 的经验吗?
我过去曾在 Leopard 上使用过它,它会在安全更新后消失,但非常简单:
$ ./configure --enable-layout=Darwin --enable-mods-shared=all
$ make
$ sudo make install
我又开始运行了。
自从 Snow Leopard 更新后,我在 make 命令上遇到了以下问题
libtool: link: cannot find the library `/usr/lib/libexpat.la' or unhandled argument `/usr/lib/libexpat.la'
make[2]: *** [htpasswd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
最佳答案
众所周知,雪豹 (SL) 基于 64 位架构,当您安装 SL 附带的 Xcode 3.2 时,gcc 编译器默认为 4.2.1,并且似乎默认为 x86_64 而不是 i386。
感谢以下网站:
- http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
- http://projects.serenity.de/php/
- http://dawsdesign.com/drupal/comment/reply/30#comment-form
- http://pixelchimp.net/blog/pixel-chimp/reverting-php-53-5210-snow-leopard (最有助于找到其他网站)
- http://www.kevinkorb.com/post/24
- http://www.latko.org/2009/01/31/compiling-64-bit-apachephp-on-mac-os-x-1056/
- http://www.gen-x-design.com/archives/recompiling-php-5-3-on-snow-leopard-with-freetype-support/
我的解决方案:
按照 hivelogic.com 上的说明在 SL 上安装 MySQL
按照 http://projects.serenity.de/php/ 上的说明安装 Apache 2.2.14 - 它使用 2.2.13 但用 14 替换 13 很容易,对吧? ;) 安装 Apache (x86_64) 后执行以下操作:
cd /usr/local/apache2/bin cp httpd /usr/sbin/ cp apachectl /usr/sbin/
As mentioned on http://www.kevinkorb.com/post/24
编译和安装包(freetype、gettext、libjpeg、libpng、mcrypt、mhash 等)在 http://projects.serenity.de/php/ 上的 Apache 安装说明之后提到在 IMAP 之前,如果您需要 IMAP,请尝试上面 url 中提到的说明,但我没有安装,因为我不需要它。
NOTE: These all compiled as x86_64 with the exception of libpng which required the the following to be compiled as 64-bit:
*export CFLAGS="-arch x86_64" ./configure
这是所有的头都在 table 上敲打和反复试验的地方。安装PHP 5.3.0。最大的问题是 ICONV 有链接问题。我在 Google 上进行了搜索,其他一些人通过在执行 ./configure 字符串后将 -lresolv 添加到 EXTRA_LIBS= 来编辑 iconv.c 文件和 Makefile 并取得了成功。我没那么幸运,但仍然需要对 --without-iconv 参数进行编辑才能正常工作。 --with-xmlrpc 也不起作用。对于 iconv hack,请参阅此 blog entry
所以这是我的 ./configure 字符串:
./configure
--prefix=/usr/local/php5
--without-iconv
--with-apxs2=/usr/local/apache2/bin/apxs
--enable-pdo
--with-gd
--with-zlib
--with-jpeg-dir=/usr/local
--with-png-dir=/usr/local
--with-libxml-dir=/usr/local
--with-curl
--with-mcrypt
--with-pdo-mysql=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-mysql=/usr/local/mysql
--with-mhash
--with-libxml-dir=/usr/local
--with-t1lib=/usr/local
--with-xsl
--with-freetype-dir=/usr/local
--with-gettext
--with-bz2=/usr
--with-openssl=/usr
--enable-bcmath
--enable-calendar
--enable-cgi
--enable-exif
--enable-ftp
--enable-gd-native-ttf
--enable-mbstring
--enable-soap
--enable-sqlite-utf8
--enable-cli
--enable-wddx
--enable-zip
make
sudo make install
最后一点,我下载了 PHP-5.3.2-dev ( http://snaps.php.net/ ),它似乎已经解决了 ICONV 和 XMLRPC 的链接问题。我对上述 ./configure 字符串所做的唯一更改是将 --without-iconv 替换为 --with-iconv=/usr/local 并添加 < em>--with-xmlrpc。这是一个开发版本,我相信它仍然有错误,所以请自行决定使用。
如果您有任何问题,请随时发表评论,我会尽力提供帮助!
关于php - 源码安装 Apache 2.2.13 + PHP 5.3 + Snow Leopard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1352899/