When trying to access the CMS via /admin on a live SilverStripe site it's suddenly starting producing a 500 error page with the following message the rest of the site is fine:
The server encountered an internal error or misconfiguration and was unable to complete your request.
The most recent errors in the error log in the public_html folder shows:
[17-Nov-2018 03:06:11 UTC] PHP Warning: Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /home/mysite/public_html/framework/control/Director.php on line 488
The error log in cPanel shows:
[Wed Nov 21 15:27:24.578366 2018] [core:alert] [pid 10504:tid 47515481941760] [client 90.242.226.###:56737] /home/bwib/public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
I've checked the .htaccess file and its somehow changed to this:
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php5_module>
php_value date.timezone "UTC"
</IfModule>
# END cPanel-generated php ini directives, do not edit
If I replace it with the original .htaccess file the entire site breaks and I get a 500 error.
Original .htaccess here:
### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
# Deny access to IIS configuration
<Files web.config>
Order deny,allow
Deny from all
</Files>
# Deny access to YAML configuration files which might include sensitive information
<Files *.yml>
Order allow,deny
Deny from all
</Files>
# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_rewrite.c>
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
DirectoryIndex disabled
</IfModule>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase '/'
# Deny access to potentially sensitive files and folders
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
# Process through SilverStripe if no file with the requested name exists.
# Pass through the original path as a query parameter, and retain the existing parameters.
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* framework/main.php?url=%1 [QSA]
SILVERSTRIPE END
The hosting company are unwilling to advise or help investigate and just keep telling me "the admin folder is empty" very unhelpful.
Some research has pointed me in the direction of these answers but I'm not sure how to apply these via cPanel or the .htaccess file:
Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set
https://github.com/kanboard/kanboard/issues/2685
Screenshot of the server settings attached:
Any advice on how to trouble shoot this would be great!
from SilverStripe 3: Can no longer access CMS admin area, receiving 500 error

No comments:
Post a Comment