HTTP_SERVER_VARS
Moderator: General Moderators
-
triplemaya
- Forum Newbie
- Posts: 5
- Joined: Sat Dec 09, 2006 3:51 am
HTTP_SERVER_VARS
Hi. I need to change the php code which tells my new installation of oscommerce which directory the code is stored in. As far as I can tell, this is set by the line
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/');
I can find many references to the value of HTTP_SERVER_VARS['SCRIPT_FILENAME'], and other HTTP_SERVER_VARS values, but no trace of where it is set.
I have searched the tutorials for HTTP_SERVER_VARS but come up blank. I've posted on the oscommerce site, but no one is answering, so I thought I'd try here. In case it is not self evident, I am a total noobie to php and oscommerce, and databases of any kind come to that!
Help much appreciated.
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/');
I can find many references to the value of HTTP_SERVER_VARS['SCRIPT_FILENAME'], and other HTTP_SERVER_VARS values, but no trace of where it is set.
I have searched the tutorials for HTTP_SERVER_VARS but come up blank. I've posted on the oscommerce site, but no one is answering, so I thought I'd try here. In case it is not self evident, I am a total noobie to php and oscommerce, and databases of any kind come to that!
Help much appreciated.
-
triplemaya
- Forum Newbie
- Posts: 5
- Joined: Sat Dec 09, 2006 3:51 am
Hi. Thanks for replying. The problem is that the original installation has all of the code files thrown into the top level directory, which is where I want to put the guts of the site, and I don't want the whole thing clutttered up with dozens of files, and the potential for name conflicts. What I am trying to do is to get the installation to look in the catalog directory, where the code usually goes, instead of the top level directory. What I need to know is how to set the variable. Cheers.
-
triplemaya
- Forum Newbie
- Posts: 5
- Joined: Sat Dec 09, 2006 3:51 am
Yup, thanks spidermoddy, that certainly ought to do it. The big question is, where is the file where it is set? I guess this really is an oscommerce question, or at least a webserver question. I've grep'd every file in the installation, and I can't find where the variable is set. Loads of files read it, which of course means that the file where it is set doesn't stand out!
-
triplemaya
- Forum Newbie
- Posts: 5
- Joined: Sat Dec 09, 2006 3:51 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
In other words, it is automatically set for you. It is a server environment variable. Although if it is being overwritten, I'd use dreamweaver to scan all source files within a directory for $_SERVER['SCRIPT_FILENAME'] =feyd wrote:SCRIPT_FILENAME is set by PHP prior to the script being run. It is the full system level path to the script that is being run. It is one of several ways to find out where the root directory for an installation is quite often.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
It's set before any PHP code executes. Unless you want to dig into the source code behind PHP's own core engine there's no place you can look for it being set.
$_SERVER['SCRIPT_FILENAME'] is the full system path to the file that is being requested by the user-agent (browser.)
var_export($_SERVER) to see what it is.
$_SERVER['SCRIPT_FILENAME'] is the full system path to the file that is being requested by the user-agent (browser.)
var_export($_SERVER) to see what it is.
-
triplemaya
- Forum Newbie
- Posts: 5
- Joined: Sat Dec 09, 2006 3:51 am