Question

J'utilise PHP 5.3 sur Debian et selon php -m 'Phar' est chargé.

Mais l'exécution mène php pyrus.phar ou php pyrus.phar config-show à aucune sortie du tout.

Ce qui pourrait être le problème?

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

[...]

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

[...]

Ce qui me confond est que libxml2 est censé être disponible par défaut pour PHP> 5.3.1 mais php -m répertorie uniquement les Libxml. Bien que php -i va me donner:

libXML support => active
libXML Compiled Version => 2.7.8
libXML Loaded Version => 20708
libXML streams => enabled
Était-ce utile?

La solution

Je l'ai trouvé:)

Il semble Debian installera une version PHP avec le patch Suhosin. Ma propre sortie de php -v affiche les informations suivantes:

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

Maintenant, il semble Suhosin provoque ce problème: elle ne permet pas le fichier phar à exécuter. Si vous regardez dans /var/log/user.log, vous devriez voir une entrée comme suit:

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)

Depuis que nous exécutons ce que sur cli, en ajoutant la ligne ci-dessous pour /etc/php5/cli/conf.d/phar.ini devrait résoudre ce problème, il l'a fait pour moi.

suhosin.executor.include.whitelist="phar"

Bonne chance:)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top