24

I recently moved my website into a new server , my database is perfectly configured but i keep getting this error and can't access my wp-admin :

Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in /www/docs/wordpress/wp-content/themes/twentyfifteen/functions.php on line 73

I get this error with every theme and even with all my plugins disabled .

15
  • 3
    You movedyour website. What are the previous and new environments? WordPress, PHP and Apache versions. Commented May 14, 2018 at 15:23
  • 1
    This would best be handled by the theme's developers I think. Commented May 14, 2018 at 15:23
  • 1
    Could be that your new server has display_errors enabled, or just a higher error_reporting level. Both of these are set in php.ini. The actual fix will be to quote the REQUEST_URI string on that line, so that it stops raising the notice in the first place. Commented May 14, 2018 at 15:29
  • 1
    It may be linked with something like this question. If so, it's up to the theme's developers to fix it. Commented May 14, 2018 at 15:32
  • 1
    Dev environment are normally configured to show you all the error message while live environment are configured not to. So this error has probably been there forever, just now you are seeing it. Commented May 14, 2018 at 15:41

5 Answers 5

58
$path = $_SERVER[‘HTTP_HOST’] . $_SERVER[REQUEST_URI];

to

$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Sign up to request clarification or add additional context in comments.

3 Comments

Is this a new PHP version issue? Why did this suddenly occur? The fix worked, thanks
Thanks it worked! what is the reason for this issue
The faulty code is part of the WP-VCD malware, and correcting it makes the website work again, but it also makes the malware work again. See this WordFence whitepaper for more information: wordfence.com/wp-content/uploads/2019/11/… I have suggested edits in this answer to reflect this. The malware affects the users of the website, attempting to install a malicious browser plugin, so it's bad. And yes, @TetraDev, it's an issue triggered by an upgrade of PHP; before that, the malware worked fine and flew under the radar.
6

Warning: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in /www/docs/wordpress/wp-content/themes/twentyfifteen/functions.php on line 73

The above error show on my site https://cartvela.org/ and I am changing

$path = $_SERVER[‘HTTP_HOST’] . $_SERVER[REQUEST_URI];

to

$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

With that code adjustment, my site comes back and error is gone

1 Comment

Just want to make everyone aware that the faulty code is part of the WP-VCD malware, and correcting it makes the website work again but also makes the malware work again. See this WordFence whitepaper for more information: wordfence.com/wp-content/uploads/2019/11/… The malware affects the users of the website, attempting to install a malicious browser plugin, so it's bad.
3

Convert

$path = $_SERVER[‘HTTP_HOST’] . $_SERVER[REQUEST_URI];

to

$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Comments

3

Be very careful when this warning occures because this can be a side effect of the wp-vcd.php malware. Check if the file wp-includes\wp-vcd.php exists. If yes, you are infected and you should not fix this warning but instead reinstall wordpress. And avoid installing nulled themes/plugins.

1 Comment

You are right, the line number 73 gives this away as the WP-VCD malware, and correcting the bug in the malware as the other answers show how to do makes the website work again but also makes the malware work again. For anyone reading this, see this WordFence whitepaper for more information: wordfence.com/wp-content/uploads/2019/11/… The malware affects the users of the website and attempts to trick them into installing a malicious browser plugin, so it's bad.
0
  1. Edit the file C:\xampp\htdocs\ngn.com\wp-content\themes\mts_splash\functions.php, proceed to line 73 and look for REQUEST_URI. Put single quotes around it (REQUEST_URI) and save the file.

  2. Proceed to WordPress and tell them about that problem

  3. Next time, proceed to WordPress immediately, as this is not a Xampp issue, its a WordPress issue.

1 Comment

The code is part of the WP-VCD malware, and correcting the bug makes the website work again but also makes the malware work again. See this WordFence whitepaper for more information: wordfence.com/wp-content/uploads/2019/11/… The bug is not a WordPress issue. The malware is bad, as it affects the users of the website and attempts to trick them into installing a malicious browser plugin.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.