我在Debian上使用PHP5.3,根据php -m的说法,'Phar‘是加载的。
但是执行php pyrus.phar或php pyrus.phar config-show根本不会产生任何输出。
可能的问题是什么?
debian:~# php -v
PHP 5.3.5-1 with Suhosin-Patch (cli) (built: Feb 19 2011 01:57:59)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbHphp -i为我提供了:
[...]
Phar
Phar: PHP Archive support => enabled
Phar EXT version => 2.0.1
Phar API version => 1.1.1
SVN revision => $Revision: 305584 $
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
gzip compression => enabled
bzip2 compression => enabled
OpenSSL support => enabled
Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Directive => Local Value => Master Value
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On
[...]让我困惑的是,PHP >5.3.1默认情况下libxml2是可用的,但是php -m只列出了libxml。虽然php -i会给我:
libXML support => active
libXML Compiled Version => 2.7.8
libXML Loaded Version => 20708
libXML streams => enabled发布于 2011-03-23 18:35:26
找到了:)
Debian似乎会安装一个带有Suhosin补丁的PHP版本。我自己的php -v输出将显示以下内容:
web01:/home/berry# php -v
PHP 5.3.5-1 with Suhosin-Patch (cli) (built: Feb 19 2011 01:57:59) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH现在,Suhosin似乎导致了这个问题:它不允许执行phar文件。如果您查看/var/log/user.log,您应该会看到如下条目:
web01:/home/berry# tail /var/log/user.log | grep pyrus
Mar 23 11:27:50 web01 suhosin[17463]: ALERT - Include filename ('phar:///home/berry/pyrus.phar/PEAR2_Pyrus-2.0.0a2/php/PEAR2/Pyrus/ScriptFrontend/Commands.php') is an URL that is not allowed (attacker 'REMOTE_ADDR not set', file '/home/berry/pyrus.phar', line 40)由于我们只在cli上执行此操作,因此将以下代码行添加到/etc/php5/cli/conf.d/phar.ini可以修复此问题,对我也是如此。
suhosin.executor.include.whitelist="phar"祝你好运:)
https://stackoverflow.com/questions/5376099
复制相似问题