开发者

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:开发者_JAVA技巧//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.


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.


Your PHP interpreter doesn't have the phar:// stream wrapper enabled (see phpinfo). That's why you get this error.
Moreover you should actually just be using:

include("z3.phar");

This is supposed to run the stub file. Which is of course of little use, if you have a dummy stub file there. It's however possible to have the stub file contain the phar:// implementation from http://pear.php.net/package/PHP_Archive - which would allow the .phar to function on PHP interpreters without builtin phar:// stream wrapper support.

I could swear I've read that somewhere. But for simplicity you could just include PHP_Archive manually and enable phar:// support this way.

stream_wrapper_register('phar', 'PHP_Archive');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜