如何在Mac OS X(10.9.4)中修复“PHP”编译问题?

4
我正在将postgresql添加到OS X Mavericks(10.9.4)上的PHP中。 按照[博客] (http://blog.rupey.org/post/63221360055/adding-postgres-support-to-php-on-os-x-mavericks)中的步骤进行操作...在错误之间进行修复,直到达到“make”步骤。 在执行“make”时,我遇到以下错误。 ------ERROR------
users-mbp:pdo_pgsql RK$ pwd
/usr/include/php/ext/pdo_pgsql

users-mbp:pdo_pgsql RK$ make
/bin/sh /usr/include/php/ext/pdo_pgsql/libtool --mode=compile cc -I/usr/include/php/ext          -I. -I/usr/include/php/ext/pdo_pgsql -DPHP_ATOM_INC -I/usr/include/php/ext/pdo_pgsql/include -I/usr/include/php/ext/pdo_pgsql/main -I/usr/include/php/ext/pdo_pgsql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/Applications/Postgres.app/Contents/Versions/9.3/include  -DHAVE_CONFIG_H  -g -O2   -c /usr/include/php/ext/pdo_pgsql/pdo_pgsql.c -o pdo_pgsql.lo 
 cc -I/usr/include/php/ext -I. -I/usr/include/php/ext/pdo_pgsql -DPHP_ATOM_INC -I/usr/include/php/ext/pdo_pgsql/include -I/usr/include/php/ext/pdo_pgsql/main -I/usr/include/php/ext/pdo_pgsql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/Applications/Postgres.app/Contents/Versions/9.3/include -DHAVE_CONFIG_H -g -O2 -c /usr/include/php/ext/pdo_pgsql/pdo_pgsql.c  -fno-common -DPIC -o .libs/pdo_pgsql.o
In file included from /usr/include/php/ext/pdo_pgsql/pdo_pgsql.c:25:
In file included from /usr/include/php/main/php.h:34:
/usr/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found
# include <zend_config.h>
      ^
1 error generated.
make: *** [pdo_pgsql.lo] Error 1
users-mbp:pdo_pgsql RK$


------ERROR------}

但是,我可以在以下目录中找到这些文件:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/php/Zend/zend.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php/Zend/zend.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/php/Zend/zend_config.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php/Zend/zend_config.h

在[post] (Having problems while try to install OAUTH with PECL in MAMP on mac OS lion)下看到了类似的问题。 -建议如下:

如果你得到以下错误:/Applications/MAMP/bin/php/php5.4.4/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found,请确保配置php源码。即在您复制所有文件的目录中运行./configure – greg Jan 19 '13 at 2:41

尽管我已经运行了 ./configure,但上述错误仍然会出现。

能帮我理解我漏掉了什么吗?

提前感谢!


似乎 zend.h 不在 /usr/include/php/Zend/ 目录下,而是在 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php/Zend/ 目录中。 - l'L'l
实际上,“zend.h”无法找到“zend_config.h”。事实上,zend_config.h并不在/usr/include/php/Zend下。相反,我看到以下两个文件在/usr/include/php/Zend下:zend_config.w32.h和zend_config.nw.h。我应该手动将zend_config.h复制到上述位置吗? - KRISH
你可以尝试这样做,或者使用它们所在的路径;不过那些文件可能也依赖于其他文件。 - l'L'l
1个回答

12

所以我找到了适合我的解决方案。

前往终端并输入:

"sudo cp -r /usr/include/php /Applications/MAMP/bin/php/php5.x.x/include/"

使用你实际使用的php版本替换粗体字母

然后运行make命令


这个救了我!默认的PHP源代码中缺少了所有这些头文件。 - JavaThunderFromDownunder
2
谢谢。对我来说,它已经将所有内容复制到了include文件夹中,但应该是include/php文件夹,因此请执行以下命令:"sudo cp -r /usr/include/php/Applications/MAMP/bin/php/php7.0.0/include/php" - fdrv
1
请注意来自@fdrv的上述评论,以及递归cp使用大写-R。 - Sean Fahey

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接