1

I'm trying to include a PHAR file (PHP Archive) in my PHP script, it works fine on WAMP, but not on my debian server !

My server has PHP5.3 (including PHAR extension natively !), but my script stops when including the PHAR (in fact Silex)

My code (file_exists() works fine):

<?php
require_once __DIR__.'/../vendor/silex.phar';

I saw that PHAR is enabled thanks to phpinfo().

However, I tried many things to correct this problem:

Nothing works... have a solution ?

5
  • I'm not sure what you think apache would have to do with a filesystem request, but did you check for php or system errors (e.g., security/permissions)? Commented Oct 2, 2011 at 21:08
  • 1
    Did you try all the things mentioned here? silex.sensiolabs.org/doc/usage.html#pitfalls Commented Oct 2, 2011 at 22:16
  • Thanks all, in fact I tried all but not together ! By setting phar option Off in the php.ini + the suhosin whitelist, it works ! Thanks ! Commented Oct 3, 2011 at 7:05
  • 2
    If all is correct you can then close your question. Commented Oct 3, 2011 at 9:28
  • and add your solution as answer. Commented Oct 3, 2011 at 18:07

2 Answers 2

2

when you use PHP with the Suhosin patch, you may need to enable the use of phars in the suhosin.ini.

You can add the line to the suhosin.ini

suhosin.executor.include.whitelist = phar

If you don't do so the script will fail silently

This is common on debian and ubuntu

Sign up to request clarification or add additional context in comments.

Comments

1

Solutions to the most common problems with getting PHAR to work are documented in the pitfalls section of the Silex documentation.

1 Comment

It may need to disable xcache/apc/eaccelerator : phar issues appends in some very specific eaccelerator config.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.