'phppyrus.phar'不会被处决

发布于 2024-10-24 21:55:40 字数 1500 浏览 2 评论 0原文

我在 Debian 上使用 PHP 5.3,并根据 php -m 加载“Phar”。

但是执行 phppyrus.phar 或 phppyrus.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

I use PHP 5.3 on Debian and according to php -m 'Phar' is loaded.

But executing php pyrus.phar or php pyrus.phar config-show leads to no output at all.

What might be the problem?

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 gives me:

[...]

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

[...]

What confuses me is that libxml2 is supposed to be available by default for PHP >5.3.1 but php -m only lists libxml.
Though php -i will give me:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖公主 2024-10-31 21:55:40

找到了:)

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"

祝你好运 :)

Found it :)

It seems Debian will install a PHP version with the Suhosin patch. My own output of php -v will show the following:

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

Now, it seems Suhosin causes this issue: it doesn't allow the phar file to be executed. If you look in /var/log/user.log, you should see an entry as follows:

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)

Since we're executing this only on cli, adding the line below to /etc/php5/cli/conf.d/phar.ini should fix this issue, it did for me.

suhosin.executor.include.whitelist="phar"

Good luck :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文