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

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

内容简介: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


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

查看所有标签

猜你喜欢:

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

RESTful Web Services Cookbook

RESTful Web Services Cookbook

Subbu Allamaraju / Yahoo Press / 2010-3-11 / USD 39.99

While the REST design philosophy has captured the imagination of web and enterprise developers alike, using this approach to develop real web services is no picnic. This cookbook includes more than 10......一起来看看 《RESTful Web Services Cookbook》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器