开发者

PHP syntax error when installing pear on mac OS X 10.6.6

I'm trying (with some problems) to install pear on my system, Mac osX 10.6.6

PHP works ok, as apache and mysql.

On /usr/local I followed the instructions:

$ curl http://pear.php.net/go-pear.phar

$ php go-pear.phar

and I get

PHP:  syntax error, unexpected BOOL_FALSE in /private/etc/php.ini on line 1050
开发者_运维技巧

I'm not sure what's wrong with my php.ini.


You can also use:

$ php -d detect_unicode=0 go-pear.phar


I finally figured it out, so I'm posting the solution for future references.

My PHP.ini was corrupted, so I had to go back to PHP.ini.default and redo all the changes.

Then I changed:

phar.require_hash = Off 

as suggested in other posts,

and finally added:

detect_unicode = Off 

Bingo! From what I understand, the Zend engine Unicode checker is enabled by default on osX 10.6 and it causes a conflict when opening a .phar

Reference: http://bugs.php.net/bug.php?id=42396
Credits to matt/technosophos for posting the workaround.


Being new to Mac I just spent few hours trying to figure out why PEAR wasn't installing on my OSX 10.6.0 setup (Apache and PHP 5.3.3 were pre-installed without PEAR). Trying to follow the usual instructions:

$ wget http://pear.php.net/go-pear.phar
$ sudo php go-pear.phar

... would just result in a string of question marks ('??????'), and no further error messages even though I had enabled display all errors.

In the end the problem was solved by reinstalling PHP5 from macports (the current version is 5.3.5). Once I had done that, 'sudo php go-pear.phar' worked without any problems.


I checked php.ini first thing when I saw the error.

This is what it looks like around line 1050:


[Phar]

; http://php.net/phar.readonly

; phar.readonly = On

; http://php.net/phar.require-hash

;phar.require_hash = On

;phar.cache_list =

(still scratching my head ...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜