How to write to error log file in PHP [closed]

If you don’t want to change anything in your php.ini file, according to PHP documentation, you can do this.

error_log("Error message\n", 3, "/mypath/php.log");

The first parameter is the string to be sent to the log. The second parameter 3 means expect a file destination. The third parameter is the log file path.

Leave a Comment