display_errors not working

I’m new at this - working through PHP concepts. I forced an error condition in a php file to test error messages. I get my conditional message that the browser was “unable to connect to the database server.” but I can’t get the verbose PHP warning message.

  • I have edited the php.ini file so that
display_errors = On

and

display_startup_errors = On

(not sure if that’s necessary).
-Restarted MySQL server
-I’m on a Mac (snow leopard)

Any help would be great.

Hi parboy, welcome to the forums,

For runtime errors (not startup) try ‘display_errors’ true

Thanks Mittineague - I tried setting the value to true and didn’t get the error to display. I suspect I’m missing something basic, possibly a bad path command - I’m not sure where to look yet.

Have you used the error suppression operator, which is an @ symbol?

SpacePhoenix

I am not familiar with that operator, where would it be if I used it?

Are you sure what you’ve done will really generate a php error?
Make sure your settings are applied. Test in the script via ini_get() or phpinfo(). You may have edited the wrong php.ini file
Make sure you have an appropriate error_reporting level. For example, E_ALL | E_STRICT

Have you got something like:

link = @mysql_connect($server,$user,$pass)

if so, remove the @

Thanks for the explanation. Fortunately (or maybe unfortunately) I hadn’t used that operator.

It’s been a while, and I was thinking the PHP error messages were the same as the MySQL error messages, but maybe not. You mentioned “verbose” error messages. Did you try

a_mysql_function_call() or die ('<p>Query Error : ' . mysql_error() . '</p>');

Thanks for all the advice - the problem resolved on a full reboot. That was unexpected - is that the nature of PHP or MySQl?

No. We should have noticed that you had said “Restarted MySQL server”. Generally, making a change in php.ini requires restarting the web server for it to take effect. You’re probably using apache as a web server.

I don’t want to miss an important point - should I have restarted apache? How is that done on a mac?

I imagine there are files named something like start.exe, restart.exe and stop.exe
If you are starting things up by directly opening and executing those files, do the same for the “restart” one. If you are running through some sort of GUI look for the appropriate command. In any case the documentation for your setup - look for a readme and read it - should tell you what you need to know.

reboot accomplishes a restart.