Solved

Syntax error in php.ini

Posted on 2015-02-20
9
395 Views
Last Modified: 2015-02-21
In my Apache error.log I get
PHP:  syntax error, unexpected '&' in /etc/php5/apache2/php.ini on line 109

What are your personal recommendations on how to suppress these '& messages' in the corresponding lines (here starting at line 108)
   error_reporting
   Default Value: E_ALL & ~E_NOTICE
   Development Value: E_ALL | E_STRICT
   Production Value: E_ALL & ~E_DEPRECATED

Open in new window

0
Comment
Question by:fibo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 36

Assisted Solution

by:Kimputer
Kimputer earned 200 total points
ID: 40621213
php ini should look like this:

error_reporting = E_ALL & ~E_NOTICE

Open in new window


Or the one of the other options. But have it in this format, comment the rest.
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 300 total points
ID: 40621327
The lines you mention are part of the documentation and should be preceded with a semi-colon (indicating a comment). Not sure why yours would be uncommented, but add the semi-colon back in and it won't throw the error. If you want to find the proper place for the error_reporting directive, do a search through your php.ini - in mine it's at line 514

;error_reporting
;Default Value: E_ALL & ~E_NOTICE
;Development Value: E_ALL | E_STRICT
;Production Value: E_ALL & ~E_DEPRECATED
0
 
LVL 29

Author Closing Comment

by:fibo
ID: 40621597
Thx. Both comments are solutions, but Chris' is more logical.

Indeed my file has around line 507 all the folowing:
; Common Values:
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_DEPRECATED

Open in new window

0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 40621609
Hey fibo.

Thanks for the points.

Be aware of the first solution - if you'd have followed that, then that error_reporting directive would have been overwritten by the proper one later in your php.ini file. You wouldn't get errors, but you'd be banging you head against the wall
wondering why the line at 108 wasn't being implemented properly, no matter what you set it to !
0
 
LVL 29

Author Comment

by:fibo
ID: 40623251
Hi Chris,

Thx for the follow-up.

I presume that some very special version of PHP come with this php.ini, since most of my other sites have the correct setup
(and I am not the only one with this problem!)
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 40623287
I've never come across a php.ini with that part of the file uncommented. Are you sure you (or someone else) has uncommented it by accident.

Just above those lines you'll usually see a few comments explaining that the section is for quick reference. Technically you don't need any of it in there, as it's just commented documentation, but all the php.ini files I've seen have it in.
0
 
LVL 29

Author Comment

by:fibo
ID: 40623307
I am not alone, this is indeed a popular problem:
https://www.google.com/search?q=php.ini+apache2+unexpected+syntax+%22%26%22
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 40623317
Hey fibo,

You can indeed get syntax errors in your php.ini for all sorts of reasons. A couple of the links that you show from google show a similar error to what you had and the response on those pages are all the same as my suggestion - that some of the lines that are meant to be comments had been uncommented.

I've seen in the past where people have been advised to uncomment certain lines in php.ini (to enable an extension, for example) and have simply uncommented the wrong bit.

I have no idea how or why this happened in your case, but it did - at some point :)
0
 
LVL 29

Author Comment

by:fibo
ID: 40623319
Random fiddling with php.ini is out of my safe or trial area, so among all the mistakes I routinely accomplish, this is presumably not one. B-)

You're right that there are many solutions proposed, not all veray clear or confidently trusatble. Hence my asking here, and glad to have had good answers!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question