本文介绍了调试php.ini语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a VM with ubuntu 12.04 and running apache2 as a web server. I've installed PHP 5.3.10 and every time I run a php application, my php.ini throws this error:

PHP:  syntax error, unexpected BOOL_FALSE in /etc/php5/cli/php.ini on line 1020

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

I'd expect that something wasn't commented out correctly in the php.ini but when I look at it, I can't see what's wrong:

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=

这有什么奇怪的地方吗?

Does anything look weird about this?

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

The applications all run i'm just tired of seeing this error and not knowing what's causing it.

推荐答案

简短答案:

不信任行号,请在错误中提到的行之前中查找语法错误.

Short answer:

Don't trust the line numbers, look for a syntax error in the lines before the line mentioned in the error.

我也有这个错误,原来我在时区周围缺少引号.

I had this error too, turned out I was missing a quotation mark around the timezone.

我的原始错误是:

PHP:  syntax error, unexpected BOOL_FALSE in /etc/php5/cli/php.ini on line 929

我在在线 876

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Madrid"

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

After that were lots of commented out lines, the next uncommented line was on 938. The original error said that there was an error on line 929, which made things nicely cryptic. I presume that the difference in line numbers has something to do with the way the php.ini file is parsed, but the point is that the line numbers can't be trusted.

我更正了第876行中缺少的引号后,错误消失了.

After I corrected the missing quotation mark on line 876 the error dissappeared.

这篇关于调试php.ini语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 03:00