I noticed that archivers/pecl-phar vanished from the ports tree on one of my FreeBSD servers.
Problem?
Reasons to remove the port were:
- the port is unmaintained
- the port was based on the outdated phar extension from pecl
- phar (in pecl) contains open security issues
The simple solution is to create a new port which of course will use the phar which is bundled in PHP’s core. And I will get to that (but feel free to beat me at it ;-)).
Solution
In the meantime, here’s a simple solution to get phar on FreeBSD.
At first, make sure you’re running PHP 5.3.8 (installed from lang/php5
). Then fetch the PHP source and compile the phar extension only.
If all goes well the modules/
directory contains a phar.so
file (among other phar-things).
The remaining steps are to copy phar.so
to your extension_dir
and load it in extension.ini
:
Feel free to double-check the location of directory:
Finally, make sure PHP loads far by adding the following to /usr/local/etc/php/extensions.ini
:
Fin
That’s all. Once you restart php, or your webserver, phar should show up in phpinfo()
.
And as soon as a new php5-phar
port is added (probably in archivers), you should make sure to delete phar.so
and also remove the line added to the .ini
.