PHP Parse Error in Wordpress project from a WPEngi

2019-07-03 15:10发布

I've inherited a Wordpress project and I am trying to get it set up. I have zero experience in Wordpress and may as well say I have zero PHP experience. So far I've managed to get the environment set up on my local machine but I am stuck on a PHP parse error which I cannot find a solution for by googling. I'd like to at least get the existing project running on my machine.

When I open up my site locally I get redirected to $ROOT/wp-admin/install.php and I get this error in the apache error_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

Line 788 is

    public function disable_indiv_plugin_update_notices( $value ) {

and the surrounding code is

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>";
}

I have a feeling it has to do with my PHP version. I am running PHP 5.4.30. Other solutions to similar problems suggested using

Any suggestions would be appreciated.

标签: php wordpress
1条回答
萌系小妹纸
2楼-- · 2019-07-03 15:32

Delete the mu-plugins folder in you LOCAL environment... the error you are seeing is a special plugin run by WP Engine on their servers for internal use. It will, as you can see, fail if run outside the WP Engine environment.

Just make sure you don't delete the mu-plugins folder on the WP Engine server when you are putting the local environment back up to production!

查看更多
登录 后发表回答