PHP 500 Error in Plesk

You may encounter random PHP 500 errors on domains with multiple subdomains.

This occurs when open_basedir protection is set to {DOCROOT}{/}{:}{TMP}{/} in Plesk's PHP settings, and multiple subdomains are defined inside a single parent domain, like in this example:

  • /var/www/vhosts/
  • /var/www/vhosts/
  • /var/www/vhosts/

You may see the 500 error in either the parent domain or one of the subdomains, depending on which domain is accessed first and where lsphp is started. You'll see an entry like this in the debug log:

2019-12-23 17:38:22.972520 [NOTICE] [1659563] [] [STDERR] PHP Fatal error:  Unknown: Failed opening required '/var/www/vhosts/' (include_path='.:/opt/alt/php73/usr/share/pear') in Unknown on line 0

Here's why: when the lsphp process is started by, it will apply open_basedir as /var/www/vhosts/, so the subdomain cannot access its files in /var/www/vhosts/

In Plesk, the {DOCROOT} variable is set to /var/www/vhosts/ or /var/www/vhosts/, for a domain and subdomain respectively.

The {WEBSPACEROOT} variable is set to /var/www/vhosts/, which is valid for all subdomains inside this same account.

There are several ways to solve this issue:

  • If you have CageFS, there might not be much extra benefit to using open_basedir, so the simplest solution is to turn it off.
  • Change open_basedir from {DOCROOT} to {WEBSPACEROOT}, though this will not apply individual open_basedir to each subdomain.
  • Edit /usr/local/lsws/conf/httpd_config.xml, insert the line <phpAppByDomain>1</phpAppByDomain> anywhere between <phpConfig> and </phpConfig>, as seen in the screenshot below, then restart LSWS, killing lsphp if necessary.

  • Admin
  • Last modified: 2022/08/30 22:29
  • by qtwrk