Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

weird $PHP_SELF problem

Status
Not open for further replies.

MrSandman666

Programmer
Feb 5, 2001
54
DE
Hello you!

I've been working on my new homepage for a while now and since it is completely based upon PHP, I have to be online in order to test it (write code - upload changes to webhost - look at site - notice stupid mistake - write some more code - upload changes to...). Since Internet access is paid by the minute and rather expensive here in Germany, I decided that I had enough, grabbed my Laptop (which runs Windows ME), downloaded Appache, downloaded PHP, installed that stuff and tried out my homepage. It works fine, except for one thing: There's a mysterious bit of information prepended to my $PHP_SELF variable: "/php/php.exe"
So, instead of "/shadowvault/index.php3", the whole thing now reads "/php/php.exe/shadowvault/index.php3". It technicaly works but it completely messes up the links, since I only use relative links. How can I get rid of this "/php/php.exe" without writing a script to remove this annoying little thing? Did I do something wrong in configuring PHP? Has anyone any idea how to fix this?

Thanks in advance.
 
I checked the php.ini, and I didn't see any settings that look like they could affect the document root. But in the apache httpd.conf, the

DocumentRoot "/path/to/docroot"

should be set to your document root - is it? I honestly don't know what affects the PHP_SELF value, but the only thing I can think of would be settings in your httpd.conf. My PHP_SELF value, as yours in your online account, comes out relative to the document root. However I have setup Apache at home with PHP, and I think the PHP_SELF value at home is also relative to the document root although I can't confirm that(since I'm not at home).

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Hmmm, yeah, I spent a great deal of time examining my hhtp.conf file but couldn't find anything suspicious. The DocumentRoot is set to the document root. And my whole PHP folder (parser, DLLs and stuff, not the documents themselves) are not even in my Document Root. That's why I don't understand where they got that from. Maybe I did something wrong with the ScriptAliasing.
Hey, could you maybe please send me your http.conf when you're at home? My eMail address is MrSandman666@gmx.de

Thanx in advance
 
Yes, I'll check to see how my PHP_SELF is at home, and I'll send you my httpd.conf.

Just so you know, I work on Linux both at home and at work, so if there is some difference caused by Windows, I'm not going to be any help. But I will send you what I have.
Hardy Merrill
Mission Critical Linux, Inc.
 
On Windows, PHP is only available as a CGI and on Win32 systems, it is just the way the server/PHP handles script execution. This means that when you execute a script, it is actually appended to /php/php.exe. This is why you see the /php/php.exe when executing a phpinfo() or even using a form action of PHP_SELF. This will not affect your scripts except if you do special things with PHP_SELF.

As an alternative to PHP_SELF (if you perform special actions based on the information in PHP_SELF), you can use something like REQUEST_URI or SCRIPT_NAME. REQUEST_URI will provide identical information along with a querystring if there is one and script name provides the name of the script with a '/'.

Chad.
 
MrSandman666, I think Chad just answered your question pretty completely - I don't think it's necessary for me to send you my config files since they will have no bearing on your windows system.
Hardy Merrill
Mission Critical Linux, Inc.
 
Yeah, sounds good. I'm gonna try as soon as I get home!
Thanks a lot!
Oh, and thanks for being willing to send me your http.conf, hmerril, even though it probably wouldn't have helped anyways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top