Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in functions.php on line 73 [duplicate]

Tags:

php

wordpress

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 .

like image 587
user3501194 Avatar asked May 14 '18 15:05

user3501194


People also ask

How to fix PHP error request_URI is undefined constant?

Warning: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ (this will throw an Error in a future version of PHP) The solution for this warning is very simple, all you have to do is include single or double quotes around the REQUEST_URI text, for example:

What is fix-PHP notice use of undefined constant?

Fix - PHP Notice: Use of undefined constant. Fix – PHP Notice: Use of undefined constant. This is a common notice / warning that occurs whenever PHP has detected the usage of an undefined constant. In case you didn’t already know, a constant is a simple value that cannot change during the execution of a script. i.e.

Why am I seeing'use of undefined request_URI'in my Apache server logs?

If you are seeing the Warning for ' Use of undefined REQUEST_URI ' in your Apache server logs, don't worry. This can easily be fixed. Before jumping to the solution let's understand why PHP gives this warning. This is more of a syntax warning, which PHP is allowing for now as PHP is an easy-going language when it comes to syntax.

Why does this PHP error message not work with a constant?

Show activity on this post. The error message is due to the unfortunate fact that PHP will implicitly declare an unknown token as a constant string of the same name. That is, it's trying to interpret this (note the missing quote marks): The only valid way this would be valid syntax in PHP is if there was previously a constant department defined.


2 Answers

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

to

$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
like image 57
Babu Avatar answered Oct 11 '22 04:10

Babu


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

like image 6
Rashid Mehmood Avatar answered Oct 11 '22 04:10

Rashid Mehmood