We’re getting this error in the error logs for our WordPress website. This comes once or twice a day but we’re not able to understand exactly what is causing this error.
[25-Jan-2023 01:57:54 UTC] PHP Warning: Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in /home/username/public_html/wp-includes/class-wp-http.php on line 11
[25-Jan-2023 01:57:54 UTC] PHP Warning: Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in /home/username/public_html/wp-includes/class-wp-http.php on line 11
[25-Jan-2023 01:57:54 UTC] PHP Warning: require(ABSPATHWPINC/class-requests.php): failed to open stream: No such file or directory in /home/username/public_html/wp-includes/class-wp-http.php on line 11
[25-Jan-2023 01:57:54 UTC] PHP Warning: require(ABSPATHWPINC/class-requests.php): failed to open stream: No such file or directory in /home/username/public_html/wp-includes/class-wp-http.php on line 11
[25-Jan-2023 01:57:54 UTC] PHP Fatal error: require(): Failed opening required 'ABSPATHWPINC/class-requests.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/username/public_html/wp-includes/class-wp-http.php on line 11
[25-Jan-2023 01:57:55 UTC] PHP Fatal error: Uncaught Error: Class 'WP_Dependencies' not found in /home/username/public_html/wp-includes/class-wp-scripts.php:18
Stack trace:
#0 {main}
thrown in /home/username/public_html/wp-includes/class-wp-scripts.php on line 18
[25-Jan-2023 01:57:56 UTC] PHP Fatal error: Uncaught Error: Class 'WP_Dependencies' not found in /home/username/public_html/wp-includes/class-wp-styles.php:18
Stack trace:
#0 {main}
thrown in /home/username/public_html/wp-includes/class-wp-styles.php on line 18
[25-Jan-2023 01:58:15 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_the_block_template_html() in /home/username/public_html/wp-includes/template-canvas.php:12
Stack trace:
#0 {main}
thrown in /home/username/public_html/wp-includes/template-canvas.php on line 12
[25-Jan-2023 01:58:37 UTC] PHP Warning: Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in /home/username/public_html/wp-includes/blocks/index.php on line 8
[25-Jan-2023 01:58:37 UTC] PHP Warning: Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in /home/username/public_html/wp-includes/blocks/index.php on line 8
[25-Jan-2023 01:58:37 UTC] PHP Warning: require(ABSPATHWPINC/blocks/legacy-widget.php): failed to open stream: No such file or directory in /home/username/public_html/wp-includes/blocks/index.php on line 11
[25-Jan-2023 01:58:37 UTC] PHP Warning: require(ABSPATHWPINC/blocks/legacy-widget.php): failed to open stream: No such file or directory in /home/username/public_html/wp-includes/blocks/index.php on line 11
[25-Jan-2023 01:58:37 UTC] PHP Fatal error: require(): Failed opening required 'ABSPATHWPINC/blocks/legacy-widget.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/username/public_html/wp-includes/blocks/index.php on line 11
[25-Jan-2023 01:58:50 UTC] PHP Fatal error: Uncaught Error: Class 'WP_Widget' not found in /home/username/public_html/wp-includes/widgets/class-wp-widget-block.php:17
Stack trace:
#0 {main}
thrown in /home/username/public_html/wp-includes/widgets/class-wp-widget-block.php on line 17
We’ve tried going through the whole WordPress code base including themes and plugins files to see if any of that is causing the issue but we’ve not been able to figure out the root cause of this.
2
Answers
It’s possible these errors are due to a cybercriminal or script kiddie probing your site with URLs that try to run php scripts buried within WordPress.
The missing ABSPATH definition gives that away. The first thing
wp_load.php
does when somebody hits a legitimate WordPress page is define that ABSPATH symbol.Then, many WordPress modules use it. If it’s missing you get that error.
Unfortunately, sites on the public net get routinely hammered by these script-kiddie requests. There’s nothing much to be done except keeping your software up to date.
If you look at your webserver log at the same timestamp as the messages you showed us, you’ll probably find the offending request or requests.
require(ABSPATHWPINC/blocks/legacy-widget.php) should be require(ABSPATH/WPINC/blocks/legacy-widget.php)
It often happens with running wp-cron.php