Re: php -w causes a parse error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux