With PHP, Is it possible to extract to memory another PHP file from a .GZ, execute it and delete it from memory?
Suppose to have into the public html directory: index.php
and site.gz
Inside it, there are:
page.php
article.php
news.php
When I give index.php?p=page1
it extract page.php from the .gz file and put it into the memory (not on the Disk) , execute it, so that the user can have the generated content displayed, and then "destroyed" once have finished to be executed?
If it's really a single gzip -c
compressed file, then you can use stream wrappers to unpack and load a PHP script right away:
include "compress.zlib://example.php.gz";
Otherwise Phars are a more convenient alternative for distribution than e.g. plain zip/tar archives.
Take note that you shouldn't use unvetted user input
$_GET["p"]
for including local files. (If that's what you're trying to do.)