Search code examples
phpphar

Phar error, can't find stub.php


I created a Phar archive of Zend Framework but I get the following error: Warning: include(): Failed opening 'phar://z3.phar/stub.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php')

This is the stub.php I used: <?php __HALT_COMPILER();

I created the archive using http://empir.sourceforge.net/ I also tried creating the archive without empir using a tutorial from a blog.

I got the same error, both times.


Solution

  • I replaced include () with: set_include_path('phar://z3.phar' . PATH_SEPARATOR . get_include_path());

    and it worked as intended.

    I wrongly believed that including a phar with an empty stub would achive the same thing.