在为 phpBB 安装 GYM Sitemaps & RSS module 2.0.RC5 后,rss 倒是能通过访问 http://bbs.zuolo.info/gymrss.php?news&digest 正常生成,现已被我用 google feedburner 烧录为 http://feeds.feedburner.com/itbbs,不过可惜重烧录后内容无法实现换行了。
http://bbs.zuolo.info/sitemap.php 本来应该可以生成 Google Sitemap 文件的,但在我实际使用中却出现了服务器错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@bbs.zuolo.info and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at bbs.zuolo.info Port 80
不得已又上 namecheap 去投诉关于我无法在 cpanel 查看网站脚本错误:
display “Internal Server Error” in http://bbs.zuolo.info/sitemap.php
but
i cannot view error-logs in cpanel,
cannot also download /var/log/message via WinSCP.How can i find error code?
得到了回复:
Hello,
You see 500 error due to interrupts in php script processing. PHP error log is present in your public_html direcotry and called error_log.
Regards,
Dennis M.
Support team
NameCheap HostingTicket Details
原来在 网站的根目录有一个 error_log 的错误文件,不过这个文件php脚本错误,天知道他们那帮人是怎么设置 apache conf 文件的,竟然连服务器错误和 PHP 脚本错误都分不清,故该文件对于我解决代码错误没有什么帮助,只是让我知道了 wordpress 插件 Thread Twitter 会引起很多数据库操作错误,以及 WP-EasyArchives 会导致共享主机限定的32M内存耗尽,所以我把两个插件删掉了。
我的根目录也经常出现一个 core.xxxxx(xxxxx表示数字),不知道是不是 wp-easyarchives 中的 core.php 文件造成的,反正我已经删除了,如果明天还会出现,则就是其他原因了。
根据我对 namecheap 的 cpanel 控制面板再次研究,发现使用预设 logs 用户 登录 ftp 可以下载网站的访问日志(不含错误日志),之前由于其 ftp 设置的帮助向导有问题且认为没有使用 winscp sftp/ssh 登录安全,故一直没有尝试。
比如配置向导提示可能是:
User: leon
Server: ftp.zuolo.infoUser: leon_logs
Server: ftp.zuolo.info
但实际上我要登录就需要改为:
User: leon@zuolo.info
Server: zuolo.infoUser: leon_logs@zuolo.info
Server: zuolo.info
但如果是使用 sftp/ssh 时用户名后面就不用加上 @zuolo.info 了。
由于不让自定义 php.ini ,且我为了能完整显示 php 脚本错误信息在 sitemap.php 的顶部加入下面代码:
error_reporting(E_ALL);
ini_set(‘display_errors’,1);
也没有任何效果。
最后只能采用最笨的方法,把所有文件和数据库都下载到本机来调试。
原来出现 Internal Server Error 只是因为我把 sitemap.php 权限设置为了 777,在改回 644后,可以发现原来的错误是 404 url 地址错误而已。
在 后台 ACP( Administration Control Panel ) 中停用 SEO 插件并删除 .htaccess 文件后问题依旧,证明并不是启用 URL 静态地址改写引用的页面地址错误。
通过不断在代码关键地方加上 die; 中断来进行调试,发现引起错误的代码位于 gym_sitemaps/includes/gym_google.php 中的第 127 至 130 行:
$this->output_data['url_sofar'] = $this->output_data['url_sofar_total'];
if ( empty($this->output_data['url_sofar']) ) {
$this->gym_error(404, ‘GYM_TOO_FEW_ITEMS’, __FILE__, __LINE__);
}
因 $this->output_data['url_sofar_total'] 中值为 empty 从而引发 404 错误。
研究半天源代码也没找到解决方法,不过重新研究页面提示发现以下信息:
This page source is either empty or does not contain enough items (less than the configured threshold in ACP) to be displayed.
A 404 Not Found header was sent to properly inform Search Engines to discard this link.
错误与 ACP 后台的一个 threshold 参数有关,找出该参数在 ACP - PHPBB SEO — Google Sitemaps 中:
Sitemaps threshold:
Minimum amount of items to display a sitemap. For the forum, this means that only forum swith more than this threshold topic will have a sitemap
默认值为10,指10个论坛版块才能生成站点地图,而不是我原以为的主题帖10个。
最终搞定,论坛的站点地图 sitemap 访问地址为:
http://bbs.zuolo.info/sitemap.php?forum

Place your comment