8

I am running the latest version of MAMP on Snow Leopard.

My php.ini file has been configured to display errors. display_errors = on. The phpinfo(); page displays the status of error reporting, it is on. I have restarted my web server several times.

I've searched through Google, and I cannot find any similar problem. Everyone just says to do exactly what I have done, but it is not working. The pages will just remain blank, (with no reporting), if I intentionally place errors.

Any thoughts as to what the problem may be?

1
  • How did you solve it, I have the same problem. :( Commented Oct 12, 2011 at 13:17

6 Answers 6

31

For any future posters who run into this issue...

I was having the same issue and found that I was making changes to the wrong php.ini files. Run phpinfo and find the path to the active php.ini file to make sure you're editing the correct one.

On my installation of mamp there were multiple instances of the /conf directory with php.ini files. The php.ini files I needed were located in the /bin/php/php[version#]/conf directory and not the MAMP/conf directory.

Exact path to the php.ini file I needed to edit:

Applications/MAMP/bin/php/php5.4.10/conf/php.ini

Change display_errors = Off to display_errors = On

Sign up to request clarification or add additional context in comments.

2 Comments

Also, make sure to restart the server when making a change to the php.ini file!
5

In addition to the display_errors directive, which has to be set to On, you might have to configure error_reporting.

For instance, you can use this in your php.ini file :

error_reporting = E_ALL


Another should, useful to test, might be to place this kind of portion of PHP code at the beginning of your script :

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

This is useful when you don't have access to php.ini and/or just want to test quickly, without having to restart the webserver.


As a sidenote, when it comes to displaying errors, the Xdebug extension is really great : when it's installed/enabled/configured, instead of just having an error message, you'll get the full stack-trace, which is much more useful ;-)

1 Comment

Thanks for you post, I appreciate it! Unfortunately, it's still not working. It looks like something is overriding everything? I am clueless, any ideas?
1

I recently experienced the same problem - in my case I had downloaded a client's Wordpress site from their live server that turned out to have been tampered with by malicious script insertion that was overriding the error reporting in order to escape detection.

A little late to help the OP(!), but perhaps of use to future searchers.

Comments

0

There might have a .htaccess file in a directory that overrides the display_errors setting set in php.ini. From your post I assume you didn't explicitly add this but a few frameworks do this by default so might be added that way. Look for a line like this in your .htaccess file:

php_value display_errors 0

and change the value to 1.

Comments

0

If you have several php sdks with several versions, first make it sure you are editing correct php.ini file. If you were right add this two lines at the beginning of the code.

error_reporting(E_ALL);
ini_set('display_errors', 'On'); // or ini_set('display_errors', 1);

Comments

0

Here's a twist to the same answer. I had the same issues, just copied and pasted the ini path from the php info page and still same problems...

turns out I made a syntax mistake when I edited my 'error_reporting' block in the php.ini.

I had E_NOTICE rather than ~E_NOTICE.

:(

So mistakes can happen in the php.ini if you were editing it and totally forgot you edited something.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.