• Resolved aer2021

    (@aer2021)


    Hello there,
    I tried to update the version of PHP from 7.4 to 8, but the site breaks up. The fatal error that shows up is this one. How can I fix it? I’ve got the latest version of WP and every theme and plugins updated.

    Fatal error: Uncaught Error: Undefined constant “‘DISALLOW_FILE_EDIT’” in /web/htdocs/mysite.com/home/wp-config.php:109 Stack trace: #0 /web/htdocs/mysite.com/home/wp-load.php(50): require_once() #1 /web/htdocs/mysite.com/home/wp-blog-header.php(13): require_once(‘…’) #2 /web/htdocs/mysite.com/home/index.php(17): require(‘…’) #3 {main} thrown in /web/htdocs/mysite.comm/home/wp-config.php on line 109

    Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello @aer2021

    You need to generate the report for PHPCompatibility for version 8, you can add the PHPCS using composer, and generate the report using command like this.

    Command example -> phpcs –report-full=C:/path/to/report/phpcs-report.txt –standard=PHPCompatibility D:/path/to/project/wordpress

    Read More here, how to add phpcs – https://odan.github.io/2020/12/22/php8-compatibility-check.html

    Thanks

    Thread Starter aer2021

    (@aer2021)

    Thanks, but I’ve never used this tool before.
    Do I have to download the whole website on my machine via FTP and then scan it or what? Instructions online about that are quite unclear. I don’t understand how can this help me solve the actual problem.

    Regards.

    Dion

    (@diondesigns)

    PHPCS is for developers, not end users. Please don’t install it. (Besides, its results would be worthless since most of the WP code is not under your control.)

    Also note that all released versions of WordPress are inompatible with PHP 8.1. If that’s what you installed, you’ll need to use PHP 8.0 instead, or revert back to PHP 7.4.

    The error message points to a line in your wp-config.php file. Please post the line that contains DISALLOW_FILE_EDIT so we can see it. Make sure to enclose it in a CODE block to insure the editor here doesn’t mangle the line.

    In the meantime, you can add two slash chatacters // to the start of that line to comment it out. That should eliminate the error while we figure out what the problem is.

    Thread Starter aer2021

    (@aer2021)

    Thank you guys, I solved the problem myself.
    Apparently, the problem was caused by Microsoft-encoded quotes. That line that was causing the issue was define( ‘DISALLOW_FILE_EDIT’, true );.

    I’ve changed that to define( 'DISALLOW_FILE_EDIT', true ); using normal quotes and it works!

    Thanks again!

    • This reply was modified 2 years, 12 months ago by aer2021.
    Dion

    (@diondesigns)

    I’m glad you resolved the issue! If you’re editing on a Windows-based system, please make sure you are using an editor optimized for code, such as Notepad++. Editors such as Word, Wordpad, and Notepad have a nasty habit of mangling code.

    Can I ask what

    “That line that was causing the issue was define( ‘DISALLOW_FILE_EDIT’, true );. ”

    That was in, file/location?
    I have a similar issue on upgrade.

    When I try and upgrade to php8, all I get is
    “There has been a critical error on this website”
    I have no clue as to what the error is.
    I have upgraded to the latest theme version which I have been told is compatible with 8,
    all my plugins are up to date.
    I don’t know how to resolve the problem, when I don’t know what the problem is.
    Please advise.

    jonbartlow

    (@jonbartlow)

    It may not be the same issue in everyone’s case. From my experience a specific plugin is often not compatible with that version of PHP.

    https://bartlowwebservices.com/docs/site-error-wordpress-website-wont-load/

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @jonbartlow If you want to direct people to your own website, OK, but do that as a “if you want more info…” direction; include the info they need to fix their problem in your reply. Otherwise, your posts will be rejected as spam.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Critical error when updating to php 8’ is closed to new replies.