WordPress升级到2.9后的一个问题

WordPress升级到2.9后莫名其妙地发现首页google reader shared items显示不正常,而后台控制板里也出现相同问题,都出现了如下的错误提示:

Warning: curl_setopt() [function.curl-setopt]: CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set in …

当时立马去google,发现很多人在报同样的问题但没什么解决方案,有的说是插件问题,停用再重启就好了,我也没这个精力去搞,首页停了google reader shared items的插件就没管了,想想等这官方的升级就应该可以解决了。今天又查查 了,官方好像依然没啥反应,但wordpress论坛又有大神出没,感谢eric.fournier提供的解决方案(具体参考这里,eric.fournier大神在13楼):
编辑文件 /wp-includes/http.php 找到第1300行,将

if ( defined( 'CURLOPT_TIMEOUT_MS' ) ) {
$timeout_ms = (int) ceil( 1000 * $r['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT_MS, $timeout_ms );
curl_setopt( $handle, CURLOPT_TIMEOUT_MS, $timeout_ms );
} else {
$timeout = (int) ceil( $r['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
}

替换为

if ( defined( 'CURLOPT_TIMEOUT_MS' ) ) {
// EDF - The option doesn't work with safe mode or when open_basedir is set. More
// research is probably necessary however this seems to fix the problems I was
// seeing in the "WordPress Development Blog" section of the Dashboard.
if ( !ini_get('safe_mode') && !ini_get('open_basedir') ) {
$timeout_ms = (int) ceil( 1000 * $r['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT_MS, $timeout_ms );
curl_setopt( $handle, CURLOPT_TIMEOUT_MS, $timeout_ms );
}
} else {
$timeout = (int) ceil( $r['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
}

O.K.,圆满解决。


update: 插件(Recommended Reading: Google Reader Shared)依然有问题,每次配置完以后是好的,首页一刷新,设置就丢了,比较奇怪。看了看官方论坛,放出了wordpress 2.9 beta1,装上以后对我的问题仍然没有解决。期待后续的正式版能解决。

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>