?
Solved

Syntax error in php.ini

Posted on 2015-02-20
9
Medium Priority
?
410 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 800 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 1200 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
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
The viewer will learn how to count occurrences of each item in an array.
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.
Suggested Courses

800 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