2011-03-21 50 views
12

我在Debian上使用PHP 5.3,并根据php -m'Phar'被加载。'php pyrus.phar'不会被执行

但是执行php pyrus.pharphp 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 GmbH 

php -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 

[...] 

什么让我困惑的是,libxml2的应该是默认情况下,PHP> 5.3.1但是PHP -m可用只列出的libxml。 虽然PHP -i会给我:

libXML support => active 
libXML Compiled Version => 2.7.8 
libXML Loaded Version => 20708 
libXML streams => enabled 
+0

尝试'PHP -d的error_reporting = E_ALL pyrus.phar'或其他常见的错误选项。你测试了哪个版本?最新的下载'2.0.0a2'似乎适用于我。 – mario 2011-03-21 10:15:02

+0

php -d error_report = E_ALL pyrus.phar再次导致根本没有输出。虽然如果我用pyrus2.phar替换命令中的pyrus.phar,它告诉我无法打开输入文件....所以发生了一些事情。是的,我正在尝试最新的pyrus。 – Raffael 2011-03-21 10:19:05

+0

我遇到了同样的问题:在Ubuntu上,它像一个魅力,但它不能在我的Debian机器上工作。我会看看我能否找到问题。 – 2011-03-23 10:27:18

回答

19

发现它:)

看来的Debian将安装PHP版本,具有了Suhosin补丁。我自己的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导致此问题:它不允许将要执行的文件药业股份。如果您在/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" 

祝你好运:)

+0

赏金是你的我的朋友...在23小时内!谢谢! – Raffael 2011-03-23 10:43:39

+0

欢呼,很高兴听到它解决了你的问题。 – 2011-03-23 10:45:07