views:

29

answers:

2

Today I installed LAMP on my Ubuntu 10.04.
I created separate VH file for my site. When I started playing with code I noticed, that there are no errors. Some times code didn't appear, but no error message. I got curious and started to search, what might cause such behaviour. After 2h of searching I still don't have answear.

Can anyone help? If there is need for more info I will be glad to add.
I hope I asked question at right place. I have some doubts, that it should be at serverfault.

+3  A: 

Try enabling display_errors in your PHP scripts:

ini_set('display_errors', true);

In any case, any actual errors should be logged to your error log file, which in my Ubuntu install sits in /var/log/apache2/error.log, or the error log files defined by your virtual hosts configuration in Apache. If setting display_errors to true solves your issue, you can change it in php.ini, which you will find as specified by phpinfo().

More about this and the differences between error_reporting, display_errors and log_errors can be found at the appropriate php.net man page.

Adriano Varoli Piazza
`ini_set("error_reporting", "true");` `error_reporting(E_ALL | E_STRICT);`
Eugene
@Eugene, I think the `"true"` needs to be just `true` or `1` or `"on"`, but you just posted that with no explanation, is that the solution or is that in your code already?
Brad F Jacobs
@Eugene: What do you mean? Setting `error_reporting` to true or setting the level of errors displayed to `E_ALL` won't show anything if `display_errors` is not set to true.
Adriano Varoli Piazza
Thank you very much. Yes php.ini fix helped to solve the problem. I didn't know about it, since I worked usually in Windows with XAMPP and I didn't have such problems there.
Eugene
+2  A: 

You need to edit php.ini, specifically display_errors, also, you might want to try php's function error_reporting.

cypher
In `/etc/php5/apache2/php.ini` I uncommented those lines `display_errors` ` Default Value: On` ` Development Value: On` ` Production Value: Off`
Eugene
@Eugene: did you restart the apache2 server?
Adriano Varoli Piazza
@Eugene if not - `sudo apache2ctl restart` or `sudo service apache2 restart` should to the trick.
Alex JL