gorka Posted June 5, 2003 Posted June 5, 2003 I'm having problems with my store since the hosting company upgraded PHP. They have told me that PHP_SELF is no longer being used. Since oscommerce uses this variable my store does not work properly. Does anyone know how to fix this? Thanks!
Dave_L Posted June 5, 2003 Posted June 5, 2003 I think that SCRIPT_NAME is the preferred replacement for PHP_SELF. Technically, it should be accessed as $_SERVER['SCRIPT_NAME'] (or HTTP_SERVER_VARS['SCRIPT_NAME'] if the PHP version is older than 4.1.0).
gorka Posted June 7, 2003 Author Posted June 7, 2003 I replaced al PHP_SELF ocurrences by $_SERVER['SCRIPT_NAME'] and it worked! Many thanks Dave! Note 1: I didn't change anything in the admin directory. PHP_SELF worked there. Weird! Note 2: In some files you will find $GLOBALS['PHP_SELF'] instead of $PHP_SELF. You have to change those also. I'm not sure if I also found $HTTP_SERVER_VARS['PHP_SELF']. Note 3: Some function define $PHP_SELF as global: global $PHP_SELF; I removed those declarations also.
orchard Posted June 7, 2003 Posted June 7, 2003 I wonder if it would work to put $PHP_SELF = $_SERVER['SCRIPT_NAME'] near in application_top.php or somewhere like that instead of substituting everywhere? Actually, I just looked and it seems like $PHP_SELF is already set up in application_top.php; maybe the code there just needs to be modified a little. In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:
gorka Posted June 7, 2003 Author Posted June 7, 2003 I tried that but it didn't work for me. Did you try it?
orchard Posted June 7, 2003 Posted June 7, 2003 No, I didn't try it. I haven't had the problem yet, so I thought I should leave it alone until it breaks. In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:
gorka Posted June 8, 2003 Author Posted June 8, 2003 I've tried to do: $PHP_SELF = $_SERVER['SCRIPT_NAME'] but It seems that is not possible to change $PHP_SELF's value. I guess it's because $PHP_SELF is a server variable and can't be changed (please correct me if I'm wrong).
orchard Posted June 8, 2003 Posted June 8, 2003 Where did you put the change? includes/application_top.php modifies $PHP_SELF and is included in many if not all the other files, so it may have been undoing/overwriting your change. In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:
Guest Posted July 16, 2003 Posted July 16, 2003 Hi, I had the same problem and heres my solution (thanks to the contributors of this discussion, without you I would still be searching): (I work on 2.2MS1, The server runs PHP 4.2.3) I changend ONLY in application_top twice the line $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; to $PHP_SELF = $_SERVER['SCRIPT_NAME']; if you want to use search engine URLS, you will also have to change (in application_top) the line $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $HTTP_SERVER_VARS['PHP_SELF']); to $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $_SERVER['SCRIPT_NAME']); I hope I could help with this. Mathias
Guest Posted August 18, 2003 Posted August 18, 2003 html_output.php old: $link = str_replace('?', '/', $link); $link = str_replace('&', '/', $link); $link = str_replace('=', '/', $link); new: $link = str_replace('?', '?', $link); $link = str_replace('&', '&', $link); $link = str_replace('=', '=', $link); greez Andy
Guest Posted August 30, 2003 Posted August 30, 2003 Matzze, Thanks..... Your suggestions helped fix the problems with /admin With viewing /catalog it still gives me that error, even after adding $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $_SERVER['SCRIPT_NAME']); to application_top.php in the /catalog/includes dir. :?:
Guest Posted August 30, 2003 Posted August 30, 2003 OOPS!! I fixed it! In /catalog/includes/appication_top.php I took out the statement if (!isset($PHP_SELF)) and left $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $_SERVER['SCRIPT_NAME']); and it all work!!! wooo!! :D
Dave_L Posted August 30, 2003 Posted August 30, 2003 Is there a notice anywhere in the PHP documentation at php.net regarding PHP_SELF being deprecated? My post above was based on second-hand information, and I'd like to know if it's "official".
raul Posted September 20, 2005 Posted September 20, 2005 The funny thing I worked out is my store have such problem as described above when I use the http://name.of.the.store address . When I add /index.php it works like charm. For some of the ppl that could be a solution. Kind regards, Raul PS. With admin section it's the same :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.