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

Earnie Boyd earnie at users.sourceforge.net
Wed Apr 14 20:01:35 UTC 2010


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


More information about the support mailing list