I have a script developed in PHP7.2 running on a CentOS machine and I've been struggling to get ob_get_contents to work.
In the php.ini file, I have set display_errors to Off
and error_reporting to this:
error_reporting = E_ALL & ~E_NOTICE
Here's the code that gets executed:
ob_start();
$result = $db->query($query); //This executes a query
$report_error = ob_get_contents();
if (!$result)
{
log_error("Query Failed: ".$report_error);
return false;
}
ob_end_flush();
ob_start();
Setting display errors to On works but I don't want to display errors in the front end to the user, that's not something we would want in production so not sure if there's another setting in the php.ini file I need to change to capture warnings but not show them in the frontend?
Thanks