Web Hosting Talk







View Full Version : Code works on local machine but not server.


JeremyL
09-23-2001, 04:23 PM
I am having an issue getting a piece of php code to work on a server. It works fine on the local windows machine but when I upload it to a linux server nothing happens.

<?
$mypage = basename(getenv("PATH_INFO"));
echo "$mypage";
?>

I also ttried

<?
$mypage = basename(getenv("PATH_INFO"));
echo ("$mypage");
?>

Can anyone tell me what config var I need to change to get this to work on the server?

Thanks

MCHost-Marc
09-23-2001, 04:36 PM
Is PHP installed on the server?

JeremyL
09-23-2001, 04:39 PM
Yes, php is installed and I have tested it on 2 different servers running RH7.1, PHP and CPanel and neither of them will do anything with the code. All other php code seems to run fine.

JeremyL
09-23-2001, 04:45 PM
Also it is definitally parsing the code since it doesn't apear in the html of the page when viewed through a browser.

I did a line by line check and I can't find any discrepencies between the local php.ini and the server's ones except for the obvious ones dealing with windows/linx paths.

jarrod
09-23-2001, 05:00 PM
My troubleshoot suggestion:


<?
$howdy = getenv("PATH_INFO");
print("howdy is $howdy");
?>

and see if PATH_INFO is even being 'passed on'. That would be the first step I would take.

I looked in the php.ini and only found settings that would keep you from changing the env. variables, not reading them.

also, the phpinfo(); function displays all the different enviormental variables that are set and their values. Might browse through that to see if you notice anything strange.

Hope that helps any.

-Jarrod

JeremyL
09-23-2001, 05:18 PM
Looks like PATH_INFO doesn't work under mod_php. Oh well.

freakysid
09-24-2001, 04:59 AM
Originally posted by JeremyL
Looks like PATH_INFO doesn't work under mod_php. Oh well.

So, you are saying that PATH does not appear in the Apache Environment table when you call phpinfo()?

Then check whether apache is running with mod_env. If not, maybe you need to load mod_env into apache.

eclipsewebs
09-24-2001, 01:42 PM
Not being a PHP expert, but could it be that the machine you are tryig it on have PHP configured so that you have to use

<?PHP as the script identifier? Just a thought, once again I am not a huge PHP expert.


<EDIT> Sorry, looks like you found a possible answer to the problem above </EDIT>


Good Luck