How to enable php error log, especially when using production php?
Sometimes there is some programming errors which cause 500 errors. But cannot see the reason anywhere.
I know the ini_set could work but I would like to set it globally for all php pages.
Hello,
In your OVH customer panel, navigate to Web Cloud > Hosting > and set your PHP environment in "Development" mode.
Doing so, the 500 error messages text should be displayed when they occur.
Development mode cannot be a solution if we need to monitor and solve production web pages.
Besides it is not good idea to reveal internal errors to all users.
Also, certain pages are called by 3rd party applications and we cannot see the output of the page.
Unfortunatelly that is not a suitable answer.
Sorry, I cannot help you.
You have no access to the php.ini file.
Try using ini_set: https://stackoverflow.com/questions/3531703/how-do-i-log-errors-and-warnings-into-a-file
ini_set works but it would require adding it everywhere.
Not a solution I was looking for.
Quite amazing if OVH does not have any easy way to set these configurations globally..
The solution was simpler than I though:
Just add a .user.ini file to the www folder. At least error_log setting seems to be effective then everywhere.
Thanks !
A better explanation to help the others:
www/.user.ini
log_errors=1
error_log=${DOCUMENT_ROOT}/../php-errors.log
error_reports=E_ALL
You can enable PHP error logging by editing your
php.inifile and setting:Then restart your server.
https://mylattecoffee.com/