I'm trying to open a txt file that doesn't exist just to display an error but it doesn't! I already modified my php.ini

error_reporting = E_ALL | E_STRICT
display_errors = On
html_errors = On

but still doesn't work. I haven't experience errors since I used PHP! It just displays nothing if it's not working

What is the code that should produce error but doesn’t? (any suppression error marks ? )

Also is any error_reporting in your programme or ini_set ?

Member Avatar for P0lT10n

Add this at the top of the .php file that handle the .txt open:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Use following code at beginning of your every php pages

ini_set('error_reporting', E_ALL);
error_reporting ( E_ALL );

Yep, divyakrishnan has the right idea. To quote the great php.net site:

If the open fails, an error of level E_WARNING is generated.

You COULD just turn on the E_WARNING flag, but it is much better to use E_ALL. It helps you to remind you about declarations, deprecated code, etc.

Hope this helps.

Hello. This is a bit late for a reply but why do I need to use the ini_set() function when I already modified the php.ini?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.