Support » Fixing WordPress » php 8.0: Warning: Constant ABSPATH already defined in..

  • Resolved cstibor

    (@cstibor)


    Hello,

    With PHP 8.0.2, WordPress doesn’t really work (newest, 5.7 version). For example, if would upload a template (totally new WordPress install, nothing changed), I get the following error:
    ‘There has been a critical error on your website, Please check your site admin email for instructions’
    And template is not uploaded (of course I know that I could do it manually).

    Also, emails are not sent from WordPress. And who knows what other problems there are.

    The background of all these problems are these error messages from php_error.log:
    PHP Warning: Constant ABSPATH already defined in /web/**/**/blog/wp-config.php on line 23

    I get these error messages also from a site with PHP 8.0, which works for years. So 2 totally new sites doesn’t work too well, and also a third send these messages.

    My hosting provider wrote me, that this is a WordPress problem, not a hosting provider problem (but maybe it is, because I didn’t find that anyone else had this problem, with warning, I only found with notice).

    Thanks a lot!

    • This topic was modified 2 weeks ago by cstibor.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Joy

    (@joyously)

    It seems that you are mixing things that are not related.
    There are several WordPress developers that are running current WP sites with PHP 8. The problems come in when plugins and themes are not ready for PHP 8.

    WordPress and PHP 8.0

    There is an issue with sending mail in WP 5.7, unrelated to PHP version. See https://core.trac.wordpress.org/ticket/52822
    For a list of other known problems in 5.7, see https://core.trac.wordpress.org/query?group=status&milestone=5.7.1

    The warning(not error) you get about ABSPATH is unrelated to PHP version and email, and is due to code external to WP. When WP defines ABSPATH, it checks if it’s defined already. No other code should be defining ABSPATH.

    Thread Starter cstibor

    (@cstibor)

    Thank you, yes I digged deeper. ABSPATH warning although remains, but sending e-mail problem was not related (it was just a coincidence). Yes, it seems that even some very popular themes and plugins are not ready for 8.0.

    However, uploading theme error: I have no idea why it doesn’t work, it really seems to be a WordPress problem, because it happens also a totally new install (and only at PHP 8.0) But I can do it manually.

    PHP Fatal error:  Uncaught ValueError: Unknown format specifier """ in /web/***/**/blog/wp-admin/theme-install.php:63
    Stack trace:
    #0 /web/***/**/blog/wp-admin/theme-install.php(63): sprintf('V\xC3\xA1ratlan hiba....', 'https://wordpre...')
    #1 {main}
      thrown in /web/***/**/blog/wp-admin/theme-install.php on line 63
    • This reply was modified 2 weeks ago by cstibor.
    Joy

    (@joyously)

    What language are you using for that site? There might be a bad value in the translation of that message.

    Thread Starter cstibor

    (@cstibor)

    Hungarian!

    Joy

    (@joyously)

    Vlad found the problem in the translation file and was asking in the #polyglot Slack channel for how to get that fixed.

    Vlad T

    (@vladytimy)

    There are people working on this as we speak and within 1-2 hours new Hungarian translations will be available to update. Check Dashboard > Updates. Props Joy for thinking about this possibility and thank you for addressing this issue here, on forums! You saved many Hungarian websites!
    Kind regards!

    Thread Starter cstibor

    (@cstibor)

    Wow, you are great, incredible! Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.