0

I've turned on errors in php.ini by removing the ; in front of the comment on line 240 of php.ini (I'm using PHP 5.4.4).

I'm using MAMP for my local server to set up a local environment, and I changed the php.ini settings in Applications > MAMP > bin > php5.4.4 > conf > php.ini (this is on OS X 10.8).

I'm still getting blank screen errors when my PHP is wrong, which is quite often, as I've just started with it. Is this the right place / way to set the errors?

3
  • Please include the actual line you uncommented. The line numbers will be different for different people.
    – terdon
    Jan 23, 2013 at 19:05
  • @terdon the line is "E_ALL - All errors and warnings"
    – sam
    Jan 23, 2013 at 20:16
  • OK, I see what is wrong. Have a look at my answer. You uncommented the wrong line.
    – terdon
    Jan 23, 2013 at 20:28

3 Answers 3

1

The line you have edited is a comment, not a directive. The PHP.ini file has a lot of information to help you out, most of it is only for you to read and not the computer.

You need to make sure that the following lines are not commented (have no ; at the beginning of the line) and have the correct values:

display_errors = On
html_errors = On
error_reporting = E_ALL

They will not necessarily be present and commented. On my system, for example, the display_errors line looked like this:

display_errors = Off

What you uncommented was a line explaining some of the PHP.ini options. It is there to explain to human users how to configure the file. Normal options have the format (note the =):

option_name = option_value

As you can see, the line you edited does not have that format. The equivalent line on my system looks like this:

; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 5.4.0)

Uncommenting that line will not help. In fact, I am surprised that PHP would work at all with it uncommented.

1
  • cheers @terdon !
    – sam
    Jan 23, 2013 at 20:38
3

Have you looked at this?

Enable PHP Error Reporting in MAMP | Gilbert Pellegrom

  • Open up /Applications/MAMP/bin/php/{your PHP version}/conf/php.ini.
  • Find display_errors = Off (around line 277) and change it to display_errors = On.
  • Restart MAMP.
2
1

The E_ALL in the php.ini is a default level for error reporting. This can be overridden by the function named "error_reporting" in a .php file. And if that file is run, or it's included from a running script, it will override the default level. You can search for the function "error_reporting" in those files and check that the level is not lower than E_ALL.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .