gnawz Posted June 18, 2010 Share Posted June 18, 2010 Dear guys, I have a code that I always use on hosts and it works but is not working now The code is: The file is functions.php // setting up the web root and server root for // this application $thisFile = str_replace('\\', '/', __FILE__); $docRoot = $_SERVER['DOCUMENT_ROOT']; $webRoot = str_replace(array($docRoot, 'functions.php'), '', $thisFile); $srvRoot = str_replace('functions.php', '', $thisFile); define('WEB_ROOT', $webRoot); define('SRV_ROOT', $srvRoot); All the web files are in the root folder lifeforea and the admin files are in the lifeforea folder ir lifeforeastafrica/admin However, when I try to access www.lifeforeastafrica/admin to login into the admoin area, I get the folloeing error: Not Found The requested URL /mnt/local/admin/login.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Someone help on how I should set my doc and server roots please..... Quote Link to comment Share on other sites More sharing options...
cags Posted June 19, 2010 Share Posted June 19, 2010 Your server is most likely configured incorrectly, meaning that $_SERVER['DOCUMENT_ROOT'] is not returning the correct value. I've only ever personally seen this happen on shared hosting and I believe is not normally using Apache as a httpd. The exactly solution to fix it will very much depend on the server software in use, but the chances are if you are not running a VPS/Dedicated Server, then you will not have the access required for fix these options. Quote Link to comment Share on other sites More sharing options...
theverychap Posted June 19, 2010 Share Posted June 19, 2010 You shouldn't really need the server root? $_SERVER['DOCUMENT_ROOT'] will always return the full path to your web root. Why do you need to use the server root as you call it? - i'll be more than happy to help Quote Link to comment Share on other sites More sharing options...
gnawz Posted June 20, 2010 Author Share Posted June 20, 2010 I use server root because I use that variable in very many places in my code Quote Link to comment Share on other sites More sharing options...
thomashw Posted June 20, 2010 Share Posted June 20, 2010 Why don't you try setting $docRoot manually rather than using $_SERVER['DOCUMENT_ROOT']? If that fixes the problem, then you know the server is configured incorrectly. 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.