Search code examples
phpphar

How do I run a php file inside a phar?


I put in the phar archive the php-file 'test.php' with the code:

<?php
echo 'hello';
?>

How to start the file and display hello on the screen? With state files, for example txt such works, but with PHP there is no:

echo file_get_contents('phar://archive.phar/test.php');

Solution

  • Please try like this require_once('phar://archive.phar/test.php');