PHP: syntax error, unexpected '&' in /etc/

2019-03-03 18:21发布

问题:

I have recently upgraded PHP 5.5.* to PHP 5.6.13.

I need to display all the errors in PHP scripts if there are any. So I have uncommented the following code in /etc/php5/cli/php.ini

error_reporting
   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
   Development Value: E_ALL
   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

And it is showing the the error "unexpected '&' on line no 107".

I know there is something wrong with in my code and the nothing is displaying in browser while executing it.

回答1:

You shouldn't be uncommenting that, its informational.

If you want all errors comment those lines back out, and look around line 445.

Set error_reporting = E_ALL

If you want to see strict mode errors then set error_reporting = E_ALL & ~E_STRICT

Make sure you restart your web server after.

One additional note, make sure you only do this for your development system. You don't want to be spitting out notices and warnings (or even displaying php errors) on a production server.



标签: php lamp