triovia Posted November 8, 2007 Share Posted November 8, 2007 Hello everyone. I'm using $_SERVER['REQUEST_URI']; to read what current directory I'm in. Everything works fine on one of my sites, however on another it's reading the current directory and file name of my include folder. Example: On the site that it works... <?php $self_url = $_SERVER['REQUEST_URI']; echo $self_url; ?> This script is in "/inc/nav.php" and it returns the directory that's in the address bar (which is what I want). Non-working Example on another domain, but on the same server: <?php $self_url = $_SERVER['REQUEST_URI']; echo $self_url; ?> This script is in "/inc/nav.php" and it returns "/inc/nav.php" no the directory thats in the address bar.... What is causing this? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 8, 2007 Share Posted November 8, 2007 Diff environments and diff php.ini settings. To get current directory, why not use the call built for that? http://us2.php.net/manual/en/function.getcwd.php PhREEEk Quote Link to comment Share on other sites More sharing options...
triovia Posted November 8, 2007 Author Share Posted November 8, 2007 thanks... I actually looked into that and it produced the same result. I'm on Cpanel and I never touched the php.ini file on either one of the sites... That's weird that it would act differently for each site. You would think the php.ini file would be installed the same... hmmm. what do you think? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 8, 2007 Share Posted November 8, 2007 Can't you use getcwd and then substr out what you need? Tell me what getcwd delivers, and what YOU want to see. Very specific examples plz... PhREEEk Quote Link to comment Share on other sites More sharing options...
triovia Posted November 10, 2007 Author Share Posted November 10, 2007 Sorry for the delayed response. getcwd delivers this: /home/lenscape/public_html/inc I want it to deliver this: /mounting/ or /matting/ etc ... depending on what page you're on. But it's only printing the directory on where the included file is located, which is /inc/ Like I said, I never really touch php.ini files and they are on the same server, just strange that they would act differently. Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.