sepoto 1 Posted February 22, 2013 Report 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? Quote Link to post Share on other sites
justsomeguy 1,135 Posted February 22, 2013 Report 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. Quote Link to post Share on other sites
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.