Rate this article :
This article was useful to you ?
Yes
No
Vous avez noté 0 étoile(s)
Sommaire
Procédure
Service concerned : shared web hosting LWS Panel
Panel concerned : LWS Panel
Level : intermediate
The error open_basedir restriction in effect appears when a PHP script tries to access a file or folder located outside the authorized space on your hosting.
It can occur in particular after migrating a website, because of an old path saved in the configuration, a misconfigured extension, or a custom script.
Keep a copy of the file before modifying it. You should also have the full error message in order to identify the refused path and the PHP file causing the problem.
The message may look like this example:
Warning: include(): open_basedir restriction in effect.
File(/home/ancien-hebergeur/public_html/config.php)
is not within the allowed path(s):
(/var/www/exemple.com/htdocs/:/tmp/)
in /var/www/exemple.com/htdocs/index.php on line 24
It contains several useful pieces of information:
/home/ancien-hebergeur/public_html/config.php is the file the script [ADDRESS] ;/var/www/exemple.com/htdocs/ corresponds to the space in which your site's files can be used ;/var/www/exemple.com/htdocs/index.php is the script [PERSON_NAME] to open the file ;line 24 indicates the line concerned in this script.In this example, the site is still using a path from an old hosting account. PHP therefore blocks access to the file.
If your site displays only a blank page or a 500 error, check the hosting logs:
open_basedir restriction in effect.The most recent lines are generally found at the end of the log.
On LWS Panel, a site's public files are generally placed in a directory like this:
/var/www/votre-domaine.fr/htdocs/
Replace votre-domaine.fr with the domain name concerned.
Then check, from the file manager or by FTP, that the searched file is [PERSON_NAME] one of its subfolders.
The incorrect path may be stored:
First look for the distinctive part of the old path, for example:
/home/ancien-hebergeur/
Do not randomly modify the internal files of WordPress, PrestaShop, or another application. Start by checking the configuration of the extension or module indicated in the error message.
Replace the old path with the real path to the file on your LWS hosting.
For example:
Ancien chemin :
/home/ancien-hebergeur/public_html/cache/
Nouveau chemin :
/var/www/votre-domaine.fr/htdocs/cache/
In a custom PHP script, it is often better to build the path from the script's folder rather than storing the server's full path.
For example:
require __DIR__ . '/config.php';
This writing allows the script to look for config.php in its own folder.
The open_basedir directive cannot be modified or disabled from a .user.ini file on LWS Panel.
This protection must not be bypassed. You must correct the path used by the site, script, or extension.
After correcting the path, clear the cache from your CMS or application interface.
An old path may remain stored in a cache file, even after the configuration has been modified.
Reproduce exactly the action that caused the error: open the relevant page, submit the form, or restart the interrupted operation.
Then check the PHP logs again. No new open_basedir restriction in effect line should appear.
The fix is complete when the relevant page or feature works again and no new open_basedir error appears in the PHP logs.
I only see a 500 error or a blank page
The full message is probably recorded in the PHP logs. Open the Logs Apache / PHP tool from the LWS Panel, then reproduce the error before refreshing the log.
The indicated path corresponds to my old host
An absolute path was not updated during the migration. Search for this path in configuration files, extension settings, and custom scripts.
Replace it with the current path of your site [ADDRESS] Panel.
I can't find where the path is stored
Look at the name of the PHP file displayed at the end of the error message. It often helps identify the application, theme, extension, or script concerned.
For an extension, first check its cache, import, backup, or temporary files settings.
The file is located in the htdocs folder, [PERSON_NAME] continues
Check that the path used by the script exactly matches the file's real location.
A symbolic link can also appear to point to a file on the site while directing PHP to a location outside the allowed space. In this case, replace the link with direct access to a file located in the site's folder.
The error returns after the modification
Clear your application's cache, then reproduce the problem. Also check that the path is not stored in multiple places.
Rate this article :
This article was useful to you ?
Yes
No
0mn reading
Cloudflare Error 524 : A timeout occured
3mn reading
How to correct a 500 error on your site with LWS Panel
9mn reading
How do I correct HTTP error codes?
0mn reading
404 error, what it is and how to correct it