Outputting all PHP errors to database not error_log
I don't think it can be done without building an own error handler, but technically, that is the one global change you're looking for.
Modified example from the manual:
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
// you'd have to import or set up the connection here
mysql_query("INSERT INTO error_log (number, string, file, line) ".
"VALUES .....");
/* Don't execute PHP internal error handler */
return true;
}
then
// set to the user defined error handler
$old_error_handler = set_error_handler("myErrorHandler");
Hide error reporting and insert into database
Hiding the error on the web browser - from Turn Off Display Error PHP.ini
At top of php file add:
display_errors(false);
log_errors(true);
Logging to mysql see the accepted answer at Outputting all PHP errors to database not error_log
PHP error_log errors to MySQL
You can only handle runtime errors with a custom error handler. The echo "foo
error in your example happens when parsing (i.e. reading in) the source. Since PHP can not fully parse the code, it can also not run your error handler on this error.
Related Topics
Artisan Migrate Could Not Find Driver
Laravel Eloquent: How to Order Results of Related Models
How to Disable Redirection After Login_Check in Symfony 2
How to Password Protect Folder/Page Using PHP Without a Db or Username
Detecting Image Type from Base64 String in PHP
How to Know If MySQLnd Is the Active Driver
Scaling a Chat App - Short Polling VS. Long Polling (Ajax, PHP)
Having Problems While Try to Install Oauth with Pecl in Mamp on MAC Os Lion
Calculating Distance Between Zip Codes in PHP
Laravel 4 - Logging SQL Queries
How to Get CPU Usage and Ram Usage Without Exec
How to Fix Memory Getting Exhausted with PHPexcel
How to Re-Save the Entity as Another Row in Doctrine 2
Laravel Catch Tokenmismatchexception
Pdo + MySQL and Broken Utf-8 Encoding