Repair OSX WebDevelopment server after OSX Upgrade

After upgrading OSX to version 10.9

Apache

check to see if apache is running; go to http://localhost. If not;

Shell commandsudo apachectl start
and try again

check to see if you can access your development sites  (probably not :) ); go to oneofyourdevdomains.local.

You probably need to restore the Apache configuration. You’ll need to fix these things;

  • re-enable the loading of any modules you need
  • re-enable the include of vhost.conf and ssl.conf
  • restore the <Directory …> statement so your development directory will work again

restart apache with

Shell commandsudo apachectl restart
and try again.

PHP

PHP will work without problems, but – if you use need specific settings for PHP, you need to set those again. Please remember; PHP in 10.8 Mountain Lion is 5.3, 10.9 Mavericks uses PHP 5.4 and 10.10 Yosemite uses PHP 5.5!

Shell commandsudo cp -a /etc/php.ini.default /etc/php.ini

Shell commandsudo sh -c "cat >> /etc/php.ini <<'EOF'
;;
;; User customizations below
;;
; Original — memory_limit = 128M
memory_limit = 196M
; Original — post_max_size = 8M
post_max_size = 200M
; Original — upload_max_filesize = 2M
upload_max_filesize = 100M
; Original — default_socket_timeout = 60
default_socket_timeout = 600
; Original — max_execution_time = 30
max_execution_time = 300
; Original — max_input_time = 60
max_input_time = 600
; Original — display_errors = Off
display_errors = on
; Original — display_startup_errors = Off
display_startup_errors = on
; Original — ;date.timezone =
date.timezone = 'Europe/Amsterdam'
EOF"

Shell commandsudo /usr/bin/php /usr/lib/php/install-pear-nozlib.phar
sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade --force pear
sudo pear upgrade
sudo pecl upgrade
sudo sh -c "cat >> /etc/php.ini <<'EOF'
; Original — ;include_path = ".:/php/includes"
include_path = ".:/usr/lib/php/pear"
EOF"

MySQL

I noticed that MySQL (MariaDB in our case) is running after upgrade and the very handy tool SequelPRO is able to connect, but PHP is not. The problem is the socket-file location. The installer of MariaDB would alter the php.ini file to set the – incorrect – location and a simple line of code would change that. So this leaves you with two options;

  1. Reinstall MariaDB, then reconfigure the mysql.socket paths in php.ini
  2. Place the socket where php expects it to be by default

The first option, you can figure that out by re-reading this post. The second option is quite simple;

Shell commandcd /var && sudo mkdir mysql && cd mysql && sudo ln -s /tmp/mysql.sock mysql.sock

PEAR/PECL/other

You need to re-install all PECL/PEAR/other modules for php. As an example; memcache.

Shell commandsudo pecl uninstall memcache

Now check if the PHP headers are available;

Shell commandcd /usr/include
ls -a

If php is listed and is a symlink to the 10.8 SDK, remove it

Shell commandsudo rm php

Now link the 10.9 headers;

Shell commandsudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php php

and also do the same for lzib.h.

Shell command sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/zlib.h zlib.h

I’m investigating an easier and more permanent way to get these links, but for now this will have to do.

Now you can install memcache again.

Shell commandsudo pecl install memcache

You can re-compile the mcrypt extension by following the original post on installing mcrypt.

Are you using xdebug?

Shell commandsudo pecl install xdebug

should install without any problem.

My series of posts also handles other additionals like subversion. I no longer use this library (svn.so) but I did check and found that the required header files are no longer included in Xcode, so I guess that there is no easy way to get it back up and running. When I find a solution, I’ll post it here :)

[August 2014: updated for OSX 10.10 Yosemite]

[March 2014: updated for mcrypt fix]

Author: Remon Pel

WebDeveloper though not WebDesigner

5 thoughts on “Repair OSX WebDevelopment server after OSX Upgrade”

  1. Many thanks for sharing!

    Poking around, I found that the upgrade left me a copy of the previous php.ini in /etc/php.ini-5.2-previous.

    As, ahem, I didn’t have a copy, this was handy for me..

  2. Thanks for the hints!
    After upgrading my Mac mini Server to Maverics my MySQL would not start up again. But in my case it was only a wrong directory name in var/mysql
    … if someone run in the same mistake like me – check the mySQL prefPane
    ;)

Leave a Reply

Your email address will not be published. Required fields are marked *