调试php.ini语法错误

Bra*_*rad 0 php ubuntu apache2

我有一个带有ubuntu 12.04的VM,并将apache2作为Web服务器运行。我已经安装了PHP 5.3.10,并且每次运行php应用程序时,我的php.ini都会引发以下错误:

PHP:  syntax error, unexpected BOOL_FALSE in /etc/php5/cli/php.ini on line 1020
Run Code Online (Sandbox Code Playgroud)

我希望php.ini中没有正确注释掉某些内容,但是当我查看它时,我看不到出了什么问题:

1007 [Pcre]
1008 ;PCRE library backtracking limit.
1009 ; http://php.net/pcre.backtrack-limit
1010 ;pcre.backtrack_limit=100000
1011 
1012 ;PCRE library recursion limit.
1013 ;Please note that if you set this value to a high number you may consume all
1014 ;the available process stack and eventually crash PHP (due to reaching the
1015 ;stack size limit imposed by the Operating System).
1016 ; http://php.net/pcre.recursion-limit
1017 ;pcre.recursion_limit=100000
1018 
1019 [Pdo]
1020 ; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"
1021 ; http://php.net/pdo-odbc.connection-pooling
1022 ;pdo_odbc.connection_pooling=strict
1023 
1024 ;pdo_odbc.db2_instance_name
1025 
1026 [Pdo_mysql]
1027 ; If mysqlnd is used: Number of cache slots for the internal result set cache
1028 ; http://php.net/pdo_mysql.cache_size
1029 pdo_mysql.cache_size = 2000
1030 
1031 ; Default socket name for local MySQL connects.  If empty, uses the built-in
1032 ; MySQL defaults.
1033 ; http://php.net/pdo_mysql.default-socket
1034 pdo_mysql.default_socket=
Run Code Online (Sandbox Code Playgroud)

看起来有什么奇怪的吗?

所有的应用程序都在运行,我只是厌倦了看到此错误并且不知道是什么原因引起的。

小智 5

简短答案:

不要相信行号,请在错误中提到的行之前的行中查找语法错误。

长答案:

我也有此错误,原来我在时区周围缺少引号。

我的原始错误是:

PHP:  syntax error, unexpected BOOL_FALSE in /etc/php5/cli/php.ini on line 929
Run Code Online (Sandbox Code Playgroud)

876行上,我有:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Madrid"
Run Code Online (Sandbox Code Playgroud)

之后,有很多注释行,下一条未注释行是938。最初的错误表示在929行出现错误,这使事情变得很神秘。我认为行号的差异与php.ini文件的解析方式有关,但要点是行号不能被信任。

在纠正了第876行上缺少的引号后,错误消失了。