Fixing openbasedir PHP error in Plesk 10

Kept getting log errors :

error_log:[Tue Mar 20 13:42:39 2012] [warn] [client 217.40.150.250] mod_fcgid: stderr: PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(XXX) is not within the allowed path(s): (VHOST DIRECTORY:/tmp/) in FILEXXX on line 334....

To fix this, turns out Plesk 10 and an updated PHP to 5.3 had removed part of the config file :

vi /usr/local/psa/admin/conf/templates/default/service/mod_fastcgi.php

<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>

# the following bit was left out by Plesk 10 and caused openbasedir errors. it stopped hosts from writing directories and files

<IfModule mod_fcgid.c>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
allow from all
</Files>
</IfModule>

Leave a Reply