您的位置:首页 > 编程语言 > PHP开发

php安装 出现Sorry, I cannot run apxs. ***错误解决方法

2015-04-28 12:25 701 查看
# tar zvxf php-5.1.2.tar.gz
# cd php-5.1.2
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/include/libxml2/libxml --with-gd --with-zlib
# make
# make install
#

*** 注: 在configure过程中, 可能会遇到下面的错误! Sorry, I cannot run apxs. ***

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

configure: error: Sorry, I cannot run apxs. Either you need to install Perl or you need to pass the absolute path of apxs by using --with-apxs=/absolute/path/to/apxs

网上有很多介绍解决方法的, 但最经典的只有Darrell Brogdon在2001/03/15写的<<Installing PHP as an Apache DSO>>, 这篇文章在绿盟有徐永久在2002-03-18翻译的中文版<<在Apache上以DSO方式安装PHP>>, 不过上面著名他本人就是文章的作者, 这点我表示怀疑.

我之所以说这么多, 只是想说明目前我看到的方法, 没有能够真正解决这个问题的.

OK, 下面我说明一下我是如何解决这个问题的:

首先, 通过错误提示, 我们得知"I cannot run apxs". 我一直以为是apxs安装有问题, 但找了很久仍未得到合理的解释和解决方法.

于是我直接运行"/usr/local/apache/bin/apxs"这个脚本, 得到下面的错误提示:

bash: ./apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory

哦, 给人的感觉很像仍然是apxs程序有问题, 但问题在哪里呢? "interpreter"是什么呢? interpreter是"解释程序"!

嗯, 看来我们接近答案了, 运行"head -1 /usr/local/apache/bin/apxs"得到下面内容:

#!/replace/with/path/to/perl/interpreter -w

天啊, 这里没有指明正确的perl执行程序的位置! 原来这就才是真正的问题原因所在!!!

把这一行更改为"#!/usr/bin/perl -w". 再运行php的configure, 一切正常!

至此, 问题已解决.

*** Sorry, I cannot run apxs. ***

原文链接:http://www.j3j5.com/post-285.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐