Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:plesk:php_500_error [2019/12/24 12:28]
qtwrk created
litespeed_wiki:plesk:php_500_error [2020/01/07 16:33]
qtwrk
Line 1: Line 1:
-When in Plesk PHP setting , +====== PHP 500 Error in Plesk ====== 
 +You may encounter random ​PHP 500 errors on domains with multiple subdomains.
  
-open_basedir protection is set to ''​{DOCROOT}{/​}{:​}{TMP}{/​}''​+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:
  
-and multiple sub-domain inside one same parent domain, e.g+  * ''/​var/​www/​vhosts/​example.com/​httpdocs/''​ 
 +  * ''/​var/​www/​vhosts/​example.com/​sub1.example.com/''​ 
 +  * ''/​var/​www/​vhosts/​example.com/​sub2.example.com/''​
  
-''/​var/​www/​vhosts/​example.com/​httpdocs/''​ +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:
- +
-''/​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:+
  
 <​code>​ <​code>​
Line 17: Line 14:
 </​code>​ </​code>​
  
-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/''​ +Here's why: when the lsphp process is started by example.com,​ it will apply open_basedir ​as ''/​var/​www/​vhosts/​example.com/​httpdocs/''​so the subdomain cannot ​access 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:+In Plesk, the ''​{DOCROOT}''​ variable is set to ''/​var/​www/​vhosts/​example.com/​httpdocs''​ or ''/​var/​www/​vhosts/​example.com/​sub1.example.com/'',​ for a domain and subdomain respectively.
  
-1If you have CageFSthere might not be much extra benefit by using open_basedir , so the simplest solution ​is to turn it off.+The ''​{WEBSPACEROOT}''​ variable is set to ''/​var/​www/​vhosts/​example.com/''​which is valid for all subdomains inside this same account.
  
-2. Change open_basedir from ''​{DOCROOT}''​ to  ''​{WEBSPACEROOT}''​ though this will not apply individual open_basedir to each sub domains.+===== Solutions: =====
  
-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.+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.
  
 {{:​litespeed_wiki:​plesk:​screenshot2019-12-2413.26.05.png|}} {{:​litespeed_wiki:​plesk:​screenshot2019-12-2413.26.05.png|}}
  
  • Admin
  • Last modified: 2022/08/30 22:29
  • by qtwrk