Support » Fixing WordPress » update to php 7 (from 5.6) gets ParseError

  • Resolved tvalleau


    I work on a non-profit site, which has LOTS of plugin. Last night, I switched the host from PHP 5.6 to PHP 7.0. I had to revert to 5.6 because when trying to access the site, either admin or public, I -immediately- get

    ParseError thrown
    syntax error, unexpected ‘<‘, expecting end of file

    OK: I understand that 5.6 is more forgiving. I’m a bit upset that there was no “… in file XYZ.php” in that less-than-helpful notice.

    But I hoping that that there’s a clue in the immediacy of the message. It’s instant. No login window; no WP logo. Just the message. I’d think that means there are only a few places to look, and I’m hoping someone here can make a suggestion.

    Here’s the htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    # Wordfence WAF
    <Files ".user.ini">
    <IfModule mod_authz_core.c>
    	Require all denied
    <IfModule !mod_authz_core.c>
    	Order deny,allow
    	Deny from all
    # END Wordfence WAF

    and here is the WAF file:

    // Before removing this file, please verify the PHP ini setting <code>auto_prepend_file</code> does not point to this.
    if (file_exists('/home/cpaorg/')) {
    	define("WFWAF_LOG_PATH", '/home/cpaorg/');
    	include_once '/home/cpaorg/';

    I’d like to move up to PHP 7, and I anyone can help with this, I’d greatly appreciate it.

    thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steve Stern (sterndata)


    Forum Moderator & Support Team Rep

    .htaccess is irrelevant for that error. It’s a PHP error.

    Errors like this are logged. Check the error log on your server. If you can’t find the log, please contact your host.

    Meantime, enable wp_debug and wp_debug_log and after an error, look at wp-content/debug.log to see if anything gets logged there.

    You can also try this: Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    Thread Starter tvalleau


    Thanks, Steve. I was aware that htaccess isn’t php, but not enough familiar with REWRITE and how it affects PHP files, that I thought there might be a clue in there.

    Also know about the proverbial “disable plugins, use default theme” but since I can’t even make it into WP-admin; since no WP logo shows up it seems logical to me that downstream plugins are not the problem.

    I’ll keep looking. Appreciate your courtesy in replying.

    Moderator Steve Stern (sterndata)


    Forum Moderator & Support Team Rep

    It’s a plugin or your theme.

    Thread Starter tvalleau


    OK… thanks.

    Thread Starter tvalleau


    The problem, of course with “disable plugin until you find the issue” is that if PHP 7 is running, I cannot log-in. All I get is the error. That means that finding the problem involves regressing the server to 5.6; log in; removing a few things; quitting; log into server and activate PHP 7; try & fail to login; regressing the server to 5.6; remove something else and so on…over and over again.

    Not being able to log in means finding the culprit is pretty much a s—load of work.

    Which is why I asked if there was some chance that there might be a different, easier-to-identify cause. I was not aware that all the theme and plugins load -before- the wp-admin.php page loads.

    • This reply was modified 5 years, 2 months ago by tvalleau.
    Thread Starter tvalleau


    Found it. It was the Google Analytics script installed in the wrong place. (Not by me, fwiw…)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘update to php 7 (from 5.6) gets ParseError’ is closed to new replies.