Tania Rascia

Skip Navigation
How to Create an Error Log in PHP

How to Create an Error Log in PHP

 /  1 response

It was only recently that I realized you could send custom error logs to whatever file you want. I just create a logs directory and told PHP to write a message to that location when the script was hit. In the below code, the message “Error message” will get sent to error.log.


error_log("Error message\n", 3, "/Users/tania/logs/error.log");


Get updated when I create new content.
Unsubscribe whenever. Never any spam.


I'm Tania. I turn down every ad, affiliate, and sponsor request I get. I write free resources that help thousands of people successfully become devs. If you enjoy my content, please consider supporting what I do.

Support my work

Write a response

Your email address will not be published. Required fields are marked *

All code will be displayed literally.