“the j stands for Journey”
about me | research blog | wordpress plugins | jQuery plugins

21 November, 2015

Fixing Apache, PHP, Pear and Haskell Platform after upgrading to OSX El Capitan

Another OSX upgrade, another long list of things that need to be manually fixed afterwards. This time it was even worse than the Mavericks upgrade.

Enable mod_rewrite and PHP in Apache

Uncomment the following lines in /etc/apache2/httpd.conf:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

Also set AllowOverride All for <Directory "/Library/WebServer/Documents">.
Restart apache with:

sudo apachectl restart

PHP

I started with a fresh config file:

sudo cp -a /etc/php.ini.default /etc/php.ini

Then added timezone information:

date.timezone = "Europe/Stockholm"

Turn off SIP

  1. Reboot into recovery mode by pressing Command + R before the apple logo appears.
  2. Open up a terminal
  3. csrutil disable; reboot

Install PEAR & PECL Mongo driver

Install PEAR:

cd /usr/lib/php
sudo php install-pear-nozlib.phar

Then add this to php.ini:

include_path = ".:/usr/lib/php/pear"

Install XCode Command Line tools with:

xcode-select --install

Next I needed to install openssl through Homebrew. This took a few steps:

sudo chown -R $(whoami):admin /usr/local
sudo chown -R _mysql:wheel /usr/local/mysql/data
brew update
brew install openssl
brew link --force openssl

Before I could build the extension I also needed this (source):

cd /usr/local/lib
sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib

Finally I installed the PECL Mongo driver (legacy) with:

sudo pecl install mongo

Then enable in php.ini by adding:

extension=mongo.so

And of course restart Apache again.

Haskell platform

I needed to recreate symlinks to Haskell platform programs inside /usr/local/bin.
This Stack Overflow answer explains how I did that.

Edit: After doing the above, GHC worked but whenever I tried to install anything in cabal I would get the error /usr/bin/ar: permission denied. After a lot of messing about, I had to clear everything Haskell-related and start over:

rm -rf ~/.cabal
rm -rf ~/Library/Haskell
sudo /Library/Haskell/bin/uninstall-hs all --remove
brew uninstall ghc cabal-install

And remove /Users/john/.cabal/bin from my path.
Then I installed GHC 7.10.2 and cabal from Homebrew and that seemed to work:

brew install ghc cabal-install

And add /Users/john/.cabal/bin back to my path.

Turn on SIP

Finally I turned SIP back on:

  1. Reboot into recovery mode again
  2. Run the following in a terminal: csrutil enable; reboot