?
Solved

$_SERVER['REQUEST_URI'] returns undefined index error

Posted on 2008-10-13
2
Medium Priority
?
1,076 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

770 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