jethro-pmm icon indicating copy to clipboard operation
jethro-pmm copied to clipboard

Improve error message if conf.php has wrong permissions

Open jefft opened this issue 1 year ago • 0 comments

When setting up Jethro, if conf.php exists but is not readable by the runtime PHP user, the browser returns a generic 500 error:

image

and in the Apache error log we get this (incorrect) error message:

[Sat Jan 20 16:15:10.546667 2024] [proxy_fcgi:error] [pid 1746389:tid 140317700662848] [remote 100.94.18.157:48972] AH01071: Got error 'PHP message: PHP Fatal error: Jethro configuration file not found. You need to copy conf.php.sample to conf.php and edit it before Jethro can run in /home/jethro/code/2.34.1/app/index.php on line 32'

The attached patch to index.php improves error messages so that both the web browser and Apache logs see the message, and

  • if conf.php does not exist, the user sees: Jethro configuration file not found. You need to copy /home/jethro/code/2.34.1/app/conf.php.sample to /home/jethro/code/2.34.1/app/conf.php and edit it before Jethro can run
  • if conf.php exists but is not readable, the runtime user is mentioned in the error message: /home/jethro/code/2.34.1/app/conf.php not readable by user www-data.

jefft avatar Jan 20 '24 05:01 jefft