⊗ppPmBsErO 5 of 447 menu

PHP Error Output

If you make a mistake in your PHP code, the server will output a description of that error directly to the browser. Errors are of three types: notice, warning, and fatal.

Notices are remarks that there might be something wrong in your code. Although the code will still work. It is better, however, not to ignore these errors, but to fix them.

Warnings are alerts that something went wrong. Typically, your code will run, but it will work differently than you intended.

Fatals occur when PHP code cannot be executed. This is usually due to a syntax error you made.

However, there is a problem. By default, notices and warnings are disabled, and instead of fatals, you will see just a white screen. This, of course, is not very informative. Let's enable the output of all errors:

<?php error_reporting(E_ALL); ?>

Sometimes, however, this command will not work (depending on the server settings). A second command will come to the rescue:

<?php ini_set('display_errors', 'on'); ?>

It's better to write both right away:

<?php error_reporting(E_ALL); ini_set('display_errors', 'on'); ?>

On a website deployed to the internet, it is better to disable error output. This is done like this:

<?php error_reporting(0); ini_set('display_errors', 'off'); ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline