Jump to content

Help on php server root and doc root


gnawz

Recommended Posts

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.....

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.