Commit 0ef8df77 authored by Fabien Potencier's avatar Fabien Potencier

merged branch laurent35240/master (PR #93)

Commits
-------

e09db842 Doc: Upgrading version of Ioncube Loader fix issue with this extension

Discussion
----------

Failed opening Silex/Application.php

I created a simple php file with this source:
<pre>
require_once __DIR__ . '/silex.phar';
$app = new Silex\Application();
</pre>

It then throw this php fatal error:
 PHP Fatal error:  require(): Failed opening required 'phar:///home/laurent/projects/bishop/silex.phar/src/Silex/Application.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///home/laurent/projects/bishop/silex.phar/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php on line 60

I have same kind of php error if I try to use silex in command line. For example:
<pre>
php silex.phar version
</pre>

My PHP version is: 5.3.5-1ubuntu7.2

---------------------------------------------------------------------------

by igorw at 2011/05/17 22:30:59 -0700

Have you tried this?

http://silex-project.org/doc/usage.html#phar-stub-bug

---------------------------------------------------------------------------

by laurent35240 at 2011/05/22 15:17:53 -0700

Yes I have tried it like that:
<pre>
  require_once __DIR__ . '/silex.phar';
  require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
  $app = new Silex\Application();
</pre>
But I still have the same error then :-(

---------------------------------------------------------------------------

by awildeep at 2011/05/23 06:11:33 -0700

I have not run into this issue yet, but do you need to include the PHAR and the autoloader.php to get it running?

I would think that this would work:

    //require_once __DIR__ . '/silex.phar';
    require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
    $app = new Silex\Application();

---------------------------------------------------------------------------

by laurent35240 at 2011/05/23 12:32:26 -0700

Nope it is still not working.

With this code
<pre>
  require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
  $app = new Silex\Application();
</pre>
I still have the error
<pre>
PHP Fatal error:  require(): Failed opening required 'phar:///home/laurent/projects/silex/silex.phar/src/Silex/Application.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///home/laurent/projects/silex/silex.phar/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php on line 60
</pre>

---------------------------------------------------------------------------

by awildeep at 2011/05/23 13:09:56 -0700

What version of PHP are you running this with?

EDIT: Nevermind, I just saw your first post comment. Is there any way this could be using a older version of PHP?

---------------------------------------------------------------------------

by brtriver at 2011/05/24 02:06:31 -0700

Have you try this? Can you find the setting of Suhosin on your phpinfo page?
http://silex-project.org/doc/usage.html#php-configuration

> suhosin.executor.include.whitelist = phar

I doubt the setting of Suhosin. If not, I'm sorry.

---------------------------------------------------------------------------

by laurent35240 at 2011/05/27 15:43:55 -0700

I finaly found the solution to my problem.
It comes from the ioncube loader for encoded files that I installed for decoding php encoded file in other projects: http://www.ioncube.com/loaders.php

Maybe it will be good to add this in Pitfalls section of documentation: http://silex-project.org/doc/usage.html#pitfalls

Thx anyway to all of you who tried to help me

---------------------------------------------------------------------------

by awildeep at 2011/05/28 06:41:27 -0700

@laurent35240 glad you found the problem.

It would seem that the obfuscating/compiling packages for PHP could play havoc with the phar.  phar packages are relatively new, and the compiler apps are 3rd party.   I was able to find a user having trouble using pear.phar here:

http://forum.ioncube.com/viewtopic.php?p=8867&sid=9102e30d35990d6caebd85cc458ebd6c

I could not find a reference to the ticket referenced above as the company does not publicly list any tickets, and their ticketing system appears to be broken.  Perhaps a note in the documentation stating that "PHP compilers and obfuscation may cause issues as well" is in order.   Anyone on the list running any other compilers or obfuscation systems?

---------------------------------------------------------------------------

by laurent35240 at 2011/05/28 07:13:43 -0700

I added in documentation details about this problem and did a pull request here: https://github.com/fabpot/Silex/pull/104

---------------------------------------------------------------------------

by ratibus at 2011/07/12 06:23:38 -0700

I had the same issue but upgrading the ioncube loader to the latest version solved it. I used the 6th June 2011 version (v4.0.9).

---------------------------------------------------------------------------

by laurent35240 at 2011/07/12 12:03:53 -0700

Using last version of ioncube loader solved the issue for me too.

Good to see that ioncube manage correctly PHAR archive now.

---------------------------------------------------------------------------

by igorw at 2011/07/12 12:05:16 -0700

Sweet! Do you want to make a pull request to the docs, mentioning this?

---------------------------------------------------------------------------

by laurent35240 at 2011/07/14 14:16:21 -0700

Sure it will be nice to mention in documentation that upgrading ioncube can resolve this problem

---------------------------------------------------------------------------

by igorw at 2011/07/14 23:29:43 -0700

Thanks Laurent!
parents 3d8ba843 e09db842
......@@ -542,9 +542,11 @@ The exact cause of this issue could not be determined yet.
ioncube loader bug
~~~~~~~~~~~~~~~~~~
Ioncube loader is an extension that can decode PHP encoded file. Unfortunately
it is not working well with phar archive. If you installed this extension, you
must disable it by commenting or removing this line in you php.ini file:
Ioncube loader is an extension that can decode PHP encoded file.
Unfortunately, old versions (prior to version 4.0.9) are not working well
with phar archive.
You must either upgrade Ioncube loder to version 4.0.9+ or disable it by
commenting or removing this line in you php.ini file:
.. code-block:: ini
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment