Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off PHP + MySQL error formatting

How to turn off PHP error formatting for getting only plain text? This should also affect MySQL related functions.

I want to get plain text, instead of structured HTML error message.

UPDATE

AS Artefact2 suggested I need to modify php.ini file, so

ini_set('html_errors', false);

does the trick if I need it in realtime.

like image 357
lukas.pukenis Avatar asked May 22 '12 16:05

lukas.pukenis


People also ask

How do I turn off PHP error reporting?

To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>

How do I ignore PHP errors?

Prepend functions with the '@' symbol to suppress certain errors, as opposed to turning off all error reporting. PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

How do I enable PHP error reporting?

The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

How do I view PHP error logs?

Look for the entry Configuration File (php. Find the Error handling and logging section of the php. ini file. Make sure that both display_errors = On, display_startup_errors = On and log_errors = On are present and uncommented. Check the value of error_log - this tells you the location of the file errors are logged to.


1 Answers

http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors

Just set html_errors to "Off" in your php.ini.

like image 127
Artefact2 Avatar answered Oct 20 '22 22:10

Artefact2