sepoto Posted February 22, 2013 Share Posted February 22, 2013 Most of the time when I install PHP I get the current directory of the .php file returned from my script. With Zend Server 6 CE DOCUMENT_ROOT seems to be truncating the .php files running directory and is always returning htdocs as the last folder regardless of the fact that my application is actually in /htdocs/samedaycrm/documentroot.php. Is there some way to change the configuration for DOCUMENT_ROOT so that it starts returning the current running directory of the .php file? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 22, 2013 Share Posted February 22, 2013 The document root setting is the document root of the web server, which is htdocs. That is a web server configuration setting, PHP is only reading the value from the web server. If you want to get the directory of the current script then for PHP 5.3 you can use the __DIR__ constant. Before 5.3 you can use dirname(__FILE__). http://www.php.net/manual/en/language.constants.predefined.php If you look inside the $_SERVER array then you should find other options that you may want to use also. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now