php - Phar archive outputs jibberish -


I created my first four collection with the following code:

  $ phar = new Phar ('myphar.phar'); $ Phar- & gt; AddFile ("index.php"); $ Phar- & gt; Set stub ($ phar- & gt; build stub ('index.php', 'index.php'));  

The index.php outlined only one output:

  echo "I'm in a PHP collection!";  

When I run the code above, myphar.phar is created and when I run on cli, the output is "I'm in a PHP collection!" However, when I call myphar.phar from a webbrover, it prints some strange characters like ???? ??? ? , instead of my index.php content and an error.

I have added the following archive to add archive to my apache httpd.conf:

  AddType application / x-httpd-php .phar  

Does anyone know why it works on the clear, but not in the browser?

Answer This problem is in

  detect_unicode < / Code> 

setting.

There is currently a bug in PHP () which __halt_compiler () does not work correctly if detect_unicode is enabled.

So set one temporarily,

  detect_unicode = off  

the price you pay in your php.ini It is the inability to use Unicode characters as the name of the variable, functions and classes (they are still fine in comments and strings).


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -