zoukankan      html  css  js  c++  java
  • php安装 出现Sorry, I cannot run apxs. ***错误解决方法

    # 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, 一切正常!

    至此, 问题已解决.


  • 相关阅读:
    传的参数乱码
    Tp5.0中分页加搜索的用法!!!
    TP5.0循环更新数据问题
    TP5.0中foreach里面使用save方法变成更新问题
    TP5.0中软删除的用法
    TP5.0中save方法加主键id的用法!!!
    用宝塔的定时任务写shell命令会以root执行的解决方法
    兆易创新RISC-V开发板评测
    使用vsCode配合IAR搭建arm开发环境
    Vue 路由导航解析流程
  • 原文地址:https://www.cnblogs.com/wajika/p/6559903.html
Copyright © 2011-2022 走看看