Re: php -w causes a parse error
| From: | Greg Beaver | Date: | Thu, 26 Jan 2006 04:04:28 +0000 |
| Subject: | Re: php -w causes a parse error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229290@lists.php.net to get a copy of this message | ||
Bom Demais wrote:
> I wanted to run "php -w" on my include files on the live server to reduce
> overhead. But php -w causes parse errors in the include files. Here's an
> example of what happens:
>
> tanner /php_files
> % php -l misc.inc
> No syntax errors detected in misc.inc
> tanner /php_files
> % php -w misc.inc > misc.stripped.inc
> tanner /php_files
> % php -l misc.stripped.inc
> PHP Parse error: parse error, unexpected '&', expecting ']' in
> misc.stripped.inc on line 2
>
> Parse error: parse error, unexpected '&', expecting ']' in
> misc.stripped.inc
> on line 2
> Errors parsing misc.stripped.inc
>
>
> Of course i try to look at line 2 to see what the error is, but now the
> whole file is on line 2, so there's no way to know what's breaking!
>
> please let me know if you have any suggestions.
My suggestion: don't try to reduce overhead by eliminating whitespace.
Take two approaches instead:
1) try to optimize by simplifying how your website does things (don't
use 30 objects and a 4000-line script just to display a template)
2) try to optimize database use (only use it where necessary, and
optimize queries) and optimize page generation by using a cache if necessary
3) ask your host provider to install a bytecode cache like Zend
Optimizer or APC.
If they have installed one already, your best efforts with php -w will
result in identical running times, and as you noted, make it impossible
to debug any problems.
Best of luck,
Greg