0

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

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.

4
  • Restarted php? Correct php.ini ? (check path to ini with phpinfo) Commented Jul 31, 2013 at 17:31
  • 1
    Looks like you are using reserved keyword as a key somewhere in your php.ini file. unexpected BOOL_FALSE generally occurs due to using reserved keywords - Yes, No, Null, True, False, On, Off, None. You can use back ticks (``) if you have to use these terms. Commented Jul 31, 2013 at 17:44
  • line 1034 ** pdo_mysql.default_socket= ** it is unassigned,, as what i can observer with ur posted message Commented Jul 31, 2013 at 17:48
  • @developerCK - "If empty, uses the built-in MySQL defaults." It can be empty, no problem. Commented Aug 21, 2013 at 19:42

2 Answers 2

5

Short answer:

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

Long answer:

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

My orignal error was:

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

On line 876 I had:

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

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.

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

Sign up to request clarification or add additional context in comments.

Comments

-2

This function solve the problem and fix some erros generate by PHP parse_ini_file. By the away, xtalk_parse_ini_file works like parse_ini_file

function xtalk_parse_ini_file( $filename ){

    $arr = array();

    $file = fopen( $filename, "r" );

    $section = "";
    $ident = "";
    $value = "";

    while ( !feof( $file ) ){           
        $linha = trim(fgets( $file )); 

        if (!$linha){
            continue;
        }   

        // replace comments
        if (substr($linha, 0, 1) == ";"){
            continue;
        }   

        if (substr($linha, 0, 1) == "["){
            $section = substr($linha, 1, strlen($linha)-2);
            continue;
        }

        $pos = strpos($linha, "=");
        if ($pos){
            $ident = trim(substr($linha, 0, $pos - 1));
            $value = trim(substr($linha, $pos + 1, strlen($linha) - $pos + 1 ));

            $pos = strpos($value, ";");
            if ( $pos ){
                $value = trim(substr($value, 0, $pos - 1 )); // replace comments    
            }

        }

        $arr[$section][$ident] = $value;

    }

    fclose($file);

    return $arr;

}

1 Comment

Hi and welcome to SO. Please avoid code-only answers. Edit your post and explain your solution briefly. It will help both the OP and everyone else to understand your idea better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.