To be honest, most of the aviation PHP projects I worked were done from the web browser front. That is the design, code and refresh approach. However I ran into several cases that required a packaging tool that depended on the php command line application.
In fact, I was looking for composer to install a required package for the solution I was researching and composer depended on the php command line. So after I got cross-eyed with the dependencies, I decided to recover by taking down personal notes on how to install all my packagers and whether I needed them in the first place.
Testing it
First to check if php is installed, type in ‘php -v’ in the terminal prompt.
[PC-NAME]:~ [pc-user-name]$ php -v
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
[PC-NAME]:~ [pc-user-name]$
Note: PHP command-line is pre-packaged with the Mac OSX
Documentation
An extract from https://php-osx.liip.ch/
All you need to do to install the whole thing is opening up a Shell and execute the following line:
PHP 7.1 (Current stable) – 10.10 and later
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1
PHP 7.0 (Old stable) – 10.10 and later
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
PHP 5.6 (Old stable) – 10.8 and later
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6
PHP 5.5 (End of life) – All OS X versions
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.5
PHP 5.4 (End of life) – All OS X versions
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.4
PHP 5.3 (End of life) – All OS X versions
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.3
It will ask you for your password. We install the packager in /usr/local/packer and PHP into /usr/local/php5 and for this, we need your password. We don’t do anything bad with it.
php.ini
The php.ini is located in /usr/local/php5/lib/php.ini, additional config files are located in /usr/local/php5/php.d/. The php.ini is based on php.ini-development
Liip php.ini
The Liip php.ini for development is located in /usr/local/php5/php.d/99-liip-developer.ini.
Re-installs into new directory
All installed files go in a new directory with every update, you have to manually maintain/merge your changes from the old directory! (like pear installs)
apc, twig and xslcache
apc, twig and xslcache need to be enabled manually in /usr/local/php5/php.d/50-extension-$name.ini.
xdebug
xdebug settings needs to be configured (idekey etc) manually in /usr/local/php5/php.d/50-extension-xdebug.ini.
apache error with ulimit
If you are seeing “/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument” when loading apache, here is a fix
Uninstall
Change in /etc/apache2/httpd.conf
LoadModule php5_module /usr/local/php5/libphp5.so
to
LoadModule php5_module libexec/apache2/libphp5.so
also delete the file +php-osx.conf and +entropy-php.conf in /etc/apache2/other
and optionally remove /usr/local/php5-*
Reinstall
To reinstall an already installed package, it’s version has to be removed from the file /usr/local/packager/registry.log.
sudo $EDITOR /usr/local/packager/registry.log
To forget all installed packages simply remove the file:
sudo rm -rf /usr/local/packager/registry.log
Source Code