In php how do you log errors but do not display them to user
error-handling, php
Solution
Use a file log
case 'development':
error_reporting(E_ALL);
ini_set('display_errors', 'Off');
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");
break;
error_log( "Hello, errors!" );
Problem
I have the following code to control my error reporting. I'm trying to make it so I can tail the error logs in our server, but I do not want any errors to be displayed on the page. I am not trying to simply make errors go away, we do not have any currently. ``` if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL); break; case 'testing': case 'production': error_reporting(0); ini_set('display_errors', 'Off'); break; default: exit('The application environment is not set correctly.'); } } ```