Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server

好久不没弄 apache和php了,突然遇到这种奇葩的问题,本来想直接在网上找现成的解决思路,结果网上搜索花了不少功夫,也没找到原因。

后来看日志文件:apachelogserror.log发现了蛛丝马迹。

[core:error] [pid 200:tid 1704] (20024)The given path is misformatted or contained invalid characters: [client 127.0.0.1:51040] AH00127: Cannot map GET /.../%3C?%20echo%20$url%20?%3E HTTP/1.1 to file, referer:

讲 

%3C?%20echo%20$url%20?%3E
解码后,我心里就有数了。

<? echo $url ?>

大概是没有启用php的short_open_tag。

打开phpphp.ini修改short_open_tag = On,重启apache,测试就没问题了。


原文地址:https://www.cnblogs.com/yelaiju/p/5236051.html