raydona Posted May 30, 2011 Share Posted May 30, 2011 Hi, I'm new to PHP, so please bear with me. I've just downloaded an application. The following is part of PHP code in a config file that came with the application: // setting up the web root and server root for // this application $thisFile = str_replace('\\', '/', __FILE__); $docRoot = $_SERVER['DOCUMENT_ROOT']; $webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile); $srvRoot = str_replace('library/config.php', '', $thisFile); define('WEB_ROOT', $webRoot); define('SRV_ROOT', $srvRoot); I don't know what are web root, server root or DOCUMENT_ROOT. Would it be possible to explain what this code is designed to do. Am I required to insert anything or make any alterations? I would be grateful for all help. Quote Link to comment https://forums.phpfreaks.com/topic/237813-unable-to-understand-code-in-config-file/ Share on other sites More sharing options...
fugix Posted May 30, 2011 Share Posted May 30, 2011 looks to me like it places scripts into your document root directory..shouldn't be tampered with unless the config file is moved to another location Quote Link to comment https://forums.phpfreaks.com/topic/237813-unable-to-understand-code-in-config-file/#findComment-1222073 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.