• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Configure open_basedir

T

trogdon

Guest
I;m getting the following errors from the SugarCRM application:

Warning: main() [function.main]: open_basedir restriction in effect. File(/MyCallsDashlet.data.php) is not within the allowed path(s): (/var/www/vhosts/mydomain.com/httpdocs:/tmp) in /var/www/vhosts/mydomain.com/httpdocs/crm/modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php on line 29

Warning: main(MyCallsDashlet.data.php) [function.main]: failed to open stream: Operation not permitted in /var/www/vhosts/mydomain.com/httpdocs/crm/modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php on line 29

Fatal error: main() [function.require]: Failed opening required 'MyCallsDashlet.data.php' (include_path='.:') in /var/www/vhosts/mydomain.com/httpdocs/crm/modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php on line 29

How do I add a open_basedir to the vhost.conf files?

Thanks.
 
Breun,

Thank you very much for your reply. I created the .conf files using the following format:

<Directory /$HTTPD_VHOSTS_D/domain.com/httpdocs>
php_admin_value open_basedir "$HTTPD_VHOSTS_D/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/httpdocs/directory"
</Directory>

When I try to execute the command thru SSH I get a message back saying the directory doesn't exist (sorry, I'm new to Linux).

Did I format the path correctly and how do you execute the command?

Thanks again for your time and help.

Bryan :)
 
You'll need to replace /HTTPD_VHOSTS_D with the actual location of your vhosts directory. This is either /home/httpd/vhosts or /var/www/vhosts. You can find out by looking up HTTPD_VHOSTS_D in /etc/psa/psa.conf:

Code:
grep HTTPD_VHOSTS_D /etc/psa/psa.conf

From your error message it appears to be /var/www/vhosts.

Also it shouldn't be necessary to add httpdocs/directory to your open_basedir path as httpdocs is already included and subdirectories of directories included in the open_basedir are also implicitly accessible.

The error seems to be that the script is trying to access a file in / (your filesystem root, not the URL root of your domain). Maybe there's an error in your SugarCRM config? Sorry, I can't help you with that.
 
In the case of Windows do I have to to add

<Directory C:\inetpub\vhosts\domain.com\httpdocs>

php_admin_value open_basedir C:\inetpub\vhosts\domain.com\httpdocs:C:\Windows\Temp:C:\inetpub\vhosts\domain.com\httpdocs\system

</Directory>

or just avoid C: to

<Directory C:\inetpub\vhosts\domain.com\httpdocs>

php_admin_value open_basedir \inetpub\vhosts\domain.com\httpdocs:\Windows\Temp:\inetpub\vhosts\domain.com\httpdocs\bitrix

</Directory>
 
You might want to ask your question in the Windows section of the forums. Or consult the Windows-specific documentation for PHP.
 
Back
Top