Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

$_SERVER['REQUEST_URI'] returns undefined index error

Posted on 2008-10-13
2
Medium Priority
?
1,079 Views
Last Modified: 2013-12-13
I had a local site I am developing work before my PC crashed. I have a new PC and have setup php 5.2.6 and now my function which used to work before does not work It returns the error:

PHP Notice: Undefined index: REQUEST_URI in C:\Nilesh\CenvetSite\custom\functions.php on line 6

Does anyone have any ideas whats going wrong?
function selfURL() {
		$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
		$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
		$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
		return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; 
	}

Open in new window

0
Comment
Question by:shankar_nr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
wktang83 earned 375 total points
ID: 22708011
Are you running the php code on IIS?

Read here for workarounds: http://orangehrm.com/forum/viewtopic.php?t=124
0
 
LVL 2

Author Closing Comment

by:shankar_nr
ID: 31505755
yep thats it. what I do not understand however is why it used to work before with php and IIS and now it doesnt.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question