Profile photo
Submitted by Michael Gardnar
on June 17th, 2011 at 07:46:32 EST

Undefined index: REQUEST_URI in PHP

I am trying to access php server variable "REQUEST_URI" using $_SERVER["REQUEST_URI"] for full page url and trying to log into my log into mySql database. But I get this Undefined index error. Any thoughts on why I "REQUEST_URI" undefined?

Profile photo
Replied by RaKumar
on June 17th, 2011 at 09:33:42 EST
Seems like you are running PHP in Windows IIS server. Server variable "REQUEST_URI" is only available in Apache server. This might be the reason you are getting undefined index error.
Accepted Answer

Profile photo
Replied by Michael Gardnar
on June 19th, 2011 at 20:35:25 EST
Yes, you are write. I am using Windows for my development machine and thats why "REQUEST_URI" does not work in my box. I tested my code in our production server which is Apache and it works fine.
Thanks for right direction.