This is an old revision of the document!


When in Plesk PHP setting ,

open_basedir protection is set to {DOCROOT}{/}{:}{TMP}{/}

and multiple sub-domain inside one same parent domain, e.g

/var/www/vhosts/example.com/httpdocs/

/var/www/vhosts/sub1.example.com/httpdocs/

/var/www/vhosts/sub2.example.com/httpdocs/

Then you may encounter randomly PHP 500 error in sub site or vice verse depends on which domain is accessed first and started lsphp, and in debug log you will see entries like this:

2019-12-23 17:38:22.972520 [NOTICE] [1659563] [123.123.123.123:51625-1#APVH_example.com:lsapi] [STDERR] PHP Fatal error:  Unknown: Failed opening required '/var/www/vhosts/example.com/sub1.example.com/index.php' (include_path='.:/opt/alt/php73/usr/share/pear') in Unknown on line 0

The reason for that error is when the lsphp process is started by example.com , it will apply open_basedir by /var/www/vhosts/example.com/httpdocs/ so the sub site can not access to its files in /var/www/vhosts/example.com/sub1.example.com/

In Plesk , variable {DOCROOT} will treated as /var/www/vhosts/example.com/httpdocs or /var/www/vhosts/example.com/sub1.example.com/ respectively.

and variable {WEBSPACEROOT will be treated as /var/www/vhosts/example.com/ which includes for all subdomains inside this same account.

Solutions:

There are several solutions to this issue:

1. If you have CageFS, there might not be much extra benefit by using open_basedir , so the simplest solution is to turn it off.

2. Change open_basedir from {DOCROOT} to {WEBSPACEROOT} though this will not apply individual open_basedir to each sub domains.

3. Edit /usr/local/lsws/conf/httpd_config.xml , insert line <phpAppByDomain>1</phpAppByDomain> anywhere between <phpConfig> and </phpConfig> , as screenshot, then restart LSWS and kill lsphp if necessary.

  • Admin
  • Last modified: 2019/12/24 12:28
  • by qtwrk