php安装 出现Sorry, I cannot run apxs. ***错误解决方法
php安装 出现Sorry, I cannot run apxs. *错误解决方法
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
首先, 通过错误提示, 我们得知"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, 一切正常!
至此, 问题已解决.