调试 php.ini 语法错误 [英] debugging a php.ini syntax error

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

问题描述

我有一个运行 ubuntu 12.04 的虚拟机,运行 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=

这有什么奇怪的吗?

所有应用程序都在运行,我只是厌倦了看到这个错误并且不知道是什么导致了它.

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

推荐答案

简答:

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

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

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 语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆