Hi,

I'm developing code for a module and uploading it to test. Usually when I develop with php I can turn error messages on with ini_set("display_errors", 1); and it will inform me of 'unexpected TSTRINGS' or '<' or ';' etc. With Drupal no such thing. I just get a blank screen. If I have 3,000 lines of code, I find myself removing chunks of lines while I narrow the error down until I can find it.

Is there a way to enable error messages in Drupal to reveal parsing errors?

Many thanks

Comments

teyser’s picture

Hi,
Check the log file in drupal or apache server.

Thanks,
Raj.

NewZeal’s picture

OK, I guess that's not as good as instant but at least it will save time.

Thanks very much

NewZeal’s picture

The Drupal log only shows the same errors that appear on screen and not the parsing errors. I have no access to the APache log so there is not much gained here. Full error reporting must be suppressed somewhere in the Drupal output stage...

lyricnz’s picture

Did you check your error-reporting configuration at admin/settings/error-reporting ?

drumming_cat’s picture

Hi,
I've got the same issue since I updated my sites to 5.12. All sites used to show PHP error messages when they ran on 5.7.
The error reporting is set to "log and screen".

Can anybody help, please? It's really tricky to have to step by step comment lines of codes til you find the actual line causing the error.

Cheers!

NewZeal’s picture

I managed to solve this problem on at least one site with the follwing:

function my_custom_module_init() {
ini_set("display_errors", 1);
}

You need to have a custom module to do this.

Alternatively just put ini_set("display_errors", 1); in settings.php and maybe that will work. Basically its a php server configuration but I've found in some setups that what works for normal php scripts doesn't always work for drupal.

Passing Phase Web Development

drumming_cat’s picture

Thanks so much, New Zeal, you saved me from hours and hours of extra work !
I added
ini_set("display_errors", 1);
in settings.php, and my good old error messages appeared again.

Yay!