Questions about your project - How to enable php error log?
Developers / Questions about your project / How to enable php error log?
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

How to enable php error log?

Von
tk
Erstellungsdatum 2025-10-06 05:50:18 in Questions about your project

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.


8 Antworten ( Latest reply on 2025-10-10 15:11:10 Von
jame laurence
)

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.

Unfortunatelly that is not a suitable answer.

  • I would like to have it in the production mode, without revealing any internal errors to everyone.
  • I don't see the output since it is called by 3rd party application. So a log file is really the only good option.

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

 

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.ini file and setting:

log_errors = On  
error_log = /path/to/error.log  
display_errors = Off

Then restart your server.

https://mylattecoffee.com/

An Diskussion teilnehmen