睡到自然醒blog

生物|生命科学| 医药健康| 科普| 分享| 学习| 交流|博客|WordPress|个人网站|

解决fsockopen(): unable to connect to google.com:80

October 12th, 2008 · 11 Comments · 建站手记

每次发表完新日志,或编辑文章发布时,总会出现一串代码错误Warning,在评论时也会出现类似错误。虽然不影响发表和评论结果,但每次出现这样的错误,还是搞的很恐怖。今天终于在WordPress官方论坛寻得良方。

错误代码:

Warning: fsockopen(): unable to connect to google.com:80 in /wp-admin/post.php
d:\clientweb\dreamfree\wwwroot\wp-includes\class-snoopy.php on line 1158

Warning: Cannot modify header information – headers already sent by (output started at d:\clientweb\dreamfree\wwwroot\wp-includes\class-snoopy.php:1158) in d:\clientweb\dreamfree\wwwroot\wp-includes\pluggable.php on line 685

以及保存草稿时:

Warning: Cannot modify header information – headers already sent by (output started at d:\clientweb\dreamfree\wwwroot\wp-includes\class-snoopy.php:1158) in d:\clientweb\dreamfree\wwwroot\wp-includes\classes.php on line 805

解决方法:

打开/wwwroot/wp-settings.php,找到71行附近,插入 if ( isset($_SERVER['PATH_INFO']) ) {…..}语句,至// Append the query string if it exists and isn’t null上方结束,即修改为以下格式,

// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
  if ( isset($_SERVER['PATH_INFO']) ) {
if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
   $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
  else
   $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; }

  // Append the query string if it exists and isn’t null

虽然是代码盲,其实大概可以看出来,这是windows iis主机出现的错误,很可能是和我以前为了去掉链接地址中的index.php设置win主机静态链接的方法不兼容,因为修改链接之前没此类错误。当然wordpress 2.5之后的版本已经修正了这个问题,既然找到解决方法,还是等到wordpress 2.7好了。

PS:这个方法只能解决部分问题,有多出来个Fatal error: Maximum execution time of 60 seconds exceeded in d:\clientweb\dreamfree\wwwroot\wp-content\plugins\google-sitemap-generator\sitemap.php on line 2303,晕了。:em52::em35:

延伸阅读:

Tags: ·

11 Comments to "解决fsockopen(): unable to connect to google.com:80" so far ↓

Leave a Comment

友情提醒:为有效防止垃圾留言,QQ、电话字眼已被加入黑名单,所以,想要索要我的QQ,请说暗号扣扣。当然,我的扣扣已经写在了这里,所以也请不要再索要偶的扣扣了。:)