我继承了一个Wordpress项目,我正在尝试设置它。我对Wordpress没有任何经验,也可以说我对PHP没有任何经验。到目前为止,我已经设法在本地机器上设置了环境,但我遇到了一个PHP解析错误,我无法通过谷歌搜索找到解决方案。我至少想让现有的项目在我的机器上运行。
当我在本地打开我的网站时,我被重定向到$ROOT/wp-admin/install.php,我在apacheerror_log:中得到了这个错误
[Wed Oct 22 22:32:42 2014] [error] [client ::1] PHP Parse error: parse error in /path/to/project/wp-content/mu-plugins/wpengine-common/plugin.php on line 788
788线为
public function disable_indiv_plugin_update_notices( $value ) {
周围的代码是
function wpengine_credits() {
if ( get_option( 'stylesheet' ) != 'twentyeleven' && get_option( 'template' ) != 'twentyeleven' )
return false;
if ( !defined('WPE_FOOTER_HTML') OR !WPE_FOOTER_HTML OR $this->already_emitted_powered_by == true )
return false;
//to prevent repeating
$this->already_emitted_powered_by = true; ?>
<div id="site-host">
WP Engine <a href="http://wpengine.com" title="<?php esc_attr_e( 'Managed WordPress Hosting', 'wpengine' ); ?>"><?php printf( __( '%s.', 'wpengine' ), 'WordPress Hosting' ); ?></a>
</div>
<?php
}
public function disable_indiv_plugin_update_notices( $value ) {
$plugins_to_disable_notices_for = array();
$basename = '';
foreach ( $plugins_to_disable_notices_for as $plugin )
$basename = plugin_basename( $plugin );
if ( isset( $value->response[@$basename] ) )
unset( $value->response[$basename] );
return $value;
}
public function get_powered_by_html( $affiliate_code = null ) {
if ( ( ! defined('WPE_FOOTER_HTML') OR !WPE_FOOTER_HTML ) AND !$this->is_widget ) return "";
$this->already_emitted_powered_by = true;
if(WPE_FOOTER_HTML !== "") {
$html = WPE_FOOTER_HTML;
} else {
$html = $this->view('general/powered-by',array('affiliate_code'=>$affiliate_code),false);
}
return "<span class='"wpengine-promo'">$html</span>";
}
我有一种感觉,这与我的PHP版本有关。我运行的是PHP 5.4.30。类似问题的其他解决方案建议使用
如有任何建议,我们将不胜感激。
删除LOCAL环境中的mu-plugins文件夹。。。您看到的错误是WP引擎在其服务器上运行的一个特殊插件,供内部使用。如您所见,如果在WP Engine环境之外运行,它将失败。
只要确保在将本地环境恢复到生产环境时,不会删除WP Engine服务器上的mu插件文件夹!