Forum Moderators: coopster

Message Too Old, No Replies

$ SERVER['PHP SELF'] error

$_SERVER['PHP_SELF'] returns physical location not the url

         

jb_sulli

5:34 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



I am trying to install a calendar program on my server but $_SERVER['PHP_SELF'] is returning the wrong information. It is returning "D:\Sever\www\calendar\install\index.php" instead of "http://localhost/calendar/install/index.php" It is important to get it to return the correct variable so that the install script will work.

penders

7:58 pm on Apr 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



$_SERVER["PHP_SELF"] should return a relative path to the document root, so in your case:
"/calendar/install/index.php"

What does $_SERVER["SCRIPT_NAME"] return? What webserver are you running?

coopster

12:19 pm on Apr 16, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, jb_sulli.

As was stated, you are likely using the incorrect $_SERVER index. Remember you can always dump the $_SERVER [php.net] variable to the browser to have a look at what is available ...

<pre> 
<?php
print_r($_SERVER);
>?
</pre>

I think you may be most interested in
DOCUMENT_ROOT