[support] Within a drupal custom module what is a more efficient way for me to detect and fix any php syntax errors?

William Smith william.darren at gmail.com
Wed Apr 14 21:14:51 UTC 2010


Yeah, turning on error reporting helps tremendously -- I hate to develop in
an environment with error reporting off.

Also, there is always the old "print 'got here'; exit;" trick which can help
when trying to isolate the bad line.

On Wed, Apr 14, 2010 at 4:01 PM, Earnie Boyd
<earnie at users.sourceforge.net>wrote:

> John Mitchell wrote:
> > I wrote my first php code within a newly created drupal module and I
> > got it to work.
> >
>
> Firsts are always good.
>
> > Initially it was not working (Drupal would not come up) and I did not
> > know what was wrong so started to take out lines until Drupal finally
> > came up and that is how I discovered which line had the syntax error.
> > Once I knew which line it was I fixed the problem and put it back in
> > the code and drupal came up.
> >
>
> The hard way to debug it. :)
>
> > My question is in the future if I have this problem again where Drupal
> > does not come up because of some php code within a custom module
> > erroring off what is a more efficient way for me to detect and fix any
> > php syntax errors?
> >
>
> Any number of ways.  If you're using apache the error would be in the
> error.log file.  And if you set the php.ini file with a log file or
> syslog then it would be there.  And then there is the PHP display_errors
> setting that can be set in .htaccess or settings.php file.
>
> .htaccess you would add
> php_value display_errors 1
>
> --
> Earnie
> -- http://progw.com
> -- http://www.for-my-kids.com
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20100414/8a44a433/attachment.html 


More information about the support mailing list