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

27 October, 2016

Fixing Apache, PHP and Homebrew after upgrading to macOS Sierra

Apache

As usual, the OSX/macOS update will delete your move your old config file.
I start with the new one and make the changes I want.
In /etc/apache2/httpd.conf, uncomment the following:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

And set AllowOverride All for <Directory "/Library/WebServer/Documents">

Homebrew

To avoid the PEAR/PECL nightmare from last time, I want to use the Mongo PHP driver from Homebrew.

First, update to XCode 8 from App Store (4GB+ download!)
Then do this to read and agree to the license:

xcode-select --install
sudo xcodebuild -license

Homebrew then gives me a warning about the permissions of /usr/local, which are fixed with this:

sudo chown -R $(whoami) /usr/local

BUT this is slightly desctructive. We need this for MySQL:

sudo chown -R _mysql:wheel /usr/local/mysql/data

Using Homebrew’s PHP and PHP-Mongo extension

We’re going to use Homebrew’s PHP rather than the system one.

brew install homebrew/php/php56 --with-apache

This apparently installed httpd24, but I want to use the system’s Apache, so:

brew unlink httpd24

Then tell the system Apache use the Homebrew PHP. In /etc/apache2/httpd.conf:

LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so

Some minor configuration for our Homebrew PHP.
In /usr/local/etc/php/5.6/php.ini:

date.timezone = "Europe/Stockholm"

Then we install the Mongo driver (note I want the old mongo, not the newer mongodb) with:

brew install homebrew/php/php56-mongo

Finally restart Apache:

sudo apachectl restart

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

26 February, 2010

johnjcamilleri.com is now seriffed

Other / , / 11:19 pm

there’s just something I like about serifs, so I thought it was about time I seriffed the fonts on my own site.

other than that, it’s still the same old boring gray theme.. tbh i’m waiting for WordPress 3 before my next major site facelift (not that the 2 are really related, but anyway…)

16 February, 2010

Goals for the new semester

Other / 5:50 pm
  1. Finish my final year project / dissertation (obviously)
  2. Become a vi or emacs pro
  3. Learn more about typography and font design
  4. Get used to using SVN
  5. Improve my handwriting to something slightly more elegant / less horrible
  6. Enjoy my last few months as an undergraduate

30 November, 2009

What’s Buzzing Malta?

So this is just a small site I built as part of my undergrad coursework. The basic idea was to build any sort of publically “useful” mashup using Ruby on Rails.

My idea is a simple site which aggregates a bunch of feed URLs, picks the most popular keywords among them all and them displays them in a cloud. Also, user interaction alters the scoring so that things keep updating themselves as people use the site.

Anyway I know it’s not much, but having this link here might help it’s ranking ever so slightly.. plus if you randomly stumble across this page, please do click so I can register some website hits 😉

Thanks… What’s Buzzing Malta

23 September, 2009

Blog Stats

Other / 7:55 am

So yesterday I wrote a post linking to the Let’s Kill IE6 initiative, and this is what happened:

blog-stats

Nice!

2 June, 2009

Remove Adobe Drive CS4 from Context Menu

I absolutely hate it when software adds context menu items without asking me.. This thread has info about removing the “Adobe Drive CS4” context menu from your system.

I use Vista x32 and the 2nd method worked for me, i.e. removing the two registry keys mentioned.

http://www.neowin.net/forum/index.php?showtopic=688632

26 May, 2009

Stuff to do this Summer

Other / , / 12:06 pm
  1. Decide on a topic for my dissertation
  2. Read more, both novels & non-fiction
  3. Learn Latex
  4. Do some Unix programming
  5. Make some money

14 April, 2008

Hello world!

Other / 2:15 am

This is my blog. It won’t be updated very often, and will only really contain code snippets/links to things that I’ve found useful. Other than that, don’t expect much else… sorry, but the world has enough stupid blogs.