How to reproduce:
- "Install" PHP 5.4 (plus ncurses and OpenSSL libraries) from CentOS 7 repositories using
rpm2cpio | cpioin a directory called "rpm"
LD_LIBRARY_PATH=rpm/usr/lib64 rpm/usr/bin/php phpunit.phar
Fatal error: Class 'Phar' not found in […]/phpunit.phar on line 12
According to the official documentation Phar is "built into" PHP 5.4, whatever "built into" means. There is indeed a
rpm/usr/bin/phar and a
rpm/usr/bin/phar.phar, but I don't know how to proceed for
rpm/usr/bin/php to handle .phar files. There is no
phar.so. There is no
phar module compiled in according to
LD_LIBRARY_PATH=dependencies/rpm/usr/lib64 dependencies/rpm/usr/bin/php -m | grep -i phar. Trying to run
phar itself results in this mess:
$ LD_LIBRARY_PATH=rpm/usr/lib64 rpm/usr/bin/php rpm/usr/bin/phar Warning: stream_wrapper_register(): class 'PHP_Archive' is undefined in […]/rpm/usr/bin/phar.phar on line 6 Warning: include(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in […]/rpm/usr/bin/phar.phar on line 9 Warning: include(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in […]/rpm/usr/bin/phar.phar on line 9 Warning: include(phar://[…]/rpm/usr/bin/phar.phar/phar.inc): failed to open stream: No such file or directory in […]/rpm/usr/bin/phar.phar on line 9 Warning: include(): Failed opening 'phar://[…]/rpm/usr/bin/phar.phar/phar.inc' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in […]/rpm/usr/bin/phar.phar on line 9 Neither Extension Phar nor class PHP_Archive are available.
I would like to avoid installing a whole suite of tools (PEAR, Composer) because that would make portability an even bigger problem than it is.
There doesn't seem to be any separate packages available for Phar. After installing
epel-release the only package matching
php-seld-phar-utils, and that doesn't seem to contain any relevant files:
# rpm --query --list php-seld-phar-utils /usr/share/doc/php-seld-phar-utils-1.0.1 /usr/share/doc/php-seld-phar-utils-1.0.1/README.md /usr/share/doc/php-seld-phar-utils-1.0.1/composer.json /usr/share/licenses/php-seld-phar-utils-1.0.1 /usr/share/licenses/php-seld-phar-utils-1.0.1/LICENSE /usr/share/php/Seld /usr/share/php/Seld/PharUtils /usr/share/php/Seld/PharUtils/Timestamps.php /usr/share/php/Seld/PharUtils/autoload.php