How to resolve open_basedir restriction error in Blesta
In our role as Outsourced hosting support specialists for web hosts, we manage web servers with various control panels and billing portals such as WHMCS, Blesta, HostBill, etc.
Blesta is a customer management, billing, and support system for web hosting providers, which is being used by many web hosts nowadays.
What causes open_basedir restriction error in Blesta
The restriction ‘open_basedir’ in PHP is a feature to restrict the directories a PHP application can access. This is a security feature to protect server files and to limit access for a software to only its own files.
So, even if an attacker gains access to a vulnerable application, it cannot access critical server files, if this restriction is in place. Instead it will see the error ‘open_basedir restriction in effect’.
If a file is outside the path defined by open_basedir, PHP cannot open it. This restriction, if enabled, can affect all PHP software in the server, including Blesta.
So, if while uploading a file or accessing any attachment in Blesta, gives the following error, it means that the folder is restricted due to open_basedir restriction, in the server.
realpath(): open_basedir restriction in effect. File(C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP56\ext) is not within the allowed path(s): (D:/PLESKVHOST/vhosts/domain.com\;C:\Windows\Temp\) on line 2 in D:\PLESKVHOST\vhosts\domain.com\httpdocs\billing\blesta\app\app_model.php
[ You don’t have to lose your sleep to keep your customers happy. Our friendly Hosting Support Specialists are online 24/7/365 to help your customers. ]
How to fix open_basedir restriction error in Blesta
To resolve the error due to open_basedir restriction, there are mainly two options.
- Disable open_basedir restriction – open_basedir can be disabled either globally or specifically for one user, which is however something we don’t recommend due to security constraints.
- Add the required path to the ‘allowed’ paths in open_basedir restriction list.
The folder in question can be obtained from the error message shown in Blesta. In this scenario, we need to specify “C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP56\ext” within its path in the php.ini, with an entry such as:
open_basedir = "C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP56\ext;C:\Windows\Temp"
Once this is done, we use a phpinfo check to confirm that the setting has taken effect. Now Blesta uploads and file access would work fine, without open_basedir restriction error for that folder.
[ Use your time to build your business. We’ll take care of your servers. Hire Our Hosting Support Specialists and boost your server performance. ]
At Bobcares, our 24/7 server specialists constantly monitor all the services in the server and proactively audit the server for any errors or corruption in them.
With our systematic debugging approach for service or other software errors, we have been able to provide an exciting support experience to the customers.
If you would like to know how to avoid downtime for your customers due to errors or other service failures, we would be happy to talk to you.