ubuntu 16.04.3上apache2服务器报告错误“script not found or unable to stat: /usr/lib/cgi-bin/...

栏目: PHP · 发布时间: 6年前

内容简介:ubuntu 16.04.3上apache2服务器报告错误“script not found or unable to stat: /usr/lib/cgi-bin/...

最近在查看服务器上的 apache2 的错误日志的时候,发现如下错误信息:

[Sun Jan 28 19:06:13.794012 2018] [cgi:error] [pid 3382:tid 139940209870592] [client 149.56.130.214:39    474] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/php
[Sun Jan 28 19:06:14.238284 2018] [cgi:error] [pid 3382:tid 139940117550848] [client 149.56.130.214:39    474] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/php5
[Sun Jan 28 19:06:15.550249 2018] [cgi:error] [pid 3382:tid 139940226656000] [client 149.56.130.214:39    474] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/php-cgi
[Sun Jan 28 19:06:15.983952 2018] [cgi:error] [pid 3382:tid 139940125943552] [client 149.56.130.214:39    474] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/php.cgi
[Sun Jan 28 19:06:16.422075 2018] [cgi:error] [pid 3382:tid 139940033623808] [client 149.56.130.214:39    474] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/php4

刚刚开始感觉莫名其妙,因为 PHP 的解析已经通过 PHP - FPM 模式进行处理,服务器上的配置已经不需要 cgi 进行处理了。

网上搜索了一下,发现这个是由于 ubuntu apache2 的默认配置模版导致的,尤其是从 ubuntu 12.04 一路升级上来的系统,在配置模版中有指出 / usr / lib / cgi - bin / 这个路径,可是这个路径已经不再使用了。

修改方式如下:

$ sudo vim /etc/apache2/sites-enabled/000-default.conf

向下查找,会发现如下内容:

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
</Directory>

如果确实网站已经不再使用任何 cgi 相关的东西了,可以直接注释掉这段代码。

另外如果开启了 HTTPS

,同理需要修改

HTTPS

对应的配置文件。

修改完成后,重启服务器:

$ sudo service apache2 restart

参考链接

script not found or unable to stat: /usr/lib/cgi-bin/php-cgi


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Looking For a Challenge

Looking For a Challenge

the University of Warsaw / the University of Warsaw / 2012-11 / 0

LOOKING FOR PROGRAMMING CHALLENGES? Then this book is for you! Whether it's the feeling of great satisfaction from solving a complex problem set, or the frustration of being unable to solve a task,......一起来看看 《Looking For a Challenge》 这本书的介绍吧!

html转js在线工具
html转js在线工具

html转js在线工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具