The Dev Pages

A knowledge base for simple (and beyond) web applications development

PHP and MySQL setup on Mac OS X 10.5 Leopard


Posted on September - 10 - 2009



Full fledged open-source MAMP development environment with php, mysql, and apache on Mac OS X 10.5 Leopard

Goal: A complete php development environment using Mac OS X 10.5 Leopard’s out of the box apache2/php install, and an install of the latest mysql and eclipse software with all the necessary plugins for php debugging. ALL 64-BIT!

Admittedly, it was a challenge to get a fully functioning php dev environment up based on Mac OS X 10.5 Leopard’s configuration. But I succeeded in not installing a separate apache/php 32-bit install, or bailing out to use a linux Virtual Box.

Enabling PHP

PHP5

This one was pretty easy. Just uncomment out the line

#LoadModule php5_module        libexec/apache2/libphp5.so

in the httpd.conf apache config (/etc/apache2/httpd.conf) so it includes the php5 module that comes with the OS.

Make sure your extension_dir in php.ini points to /usr/lib/php5/extensions/no-debug-non-zts-20060613/ or go nuts and do your own extension directory.

Debugging 64-bit

This was one of the trickier things. You need to get an X-Debug extension setup. Hopefully you can just use my 64-bit extension file, and put that in your extensions directory (/usr/lib/php5/extensions/no-debug-non-zts-20060613/). Then add the zend_extension directive to the php.ini, along with the X-Debug settings, pointing to your (local or remote) host. In your php.ini:

xbedug.so (specific to 64-bit Mac OS X)

If that short version doesn’t work, you need to compile a 64-bit extension from the xdebug source, which was sort of tricky. You’ll need to get a compiler installed on your Mac OS if you haven’t got the right developer tools installed (XCode from the install disk or mac;s website), and then follow the instructions in this article.

http://www.vividreflection.com/blog/installing-xdebug-on-macosx/
http://www.designified.com/blog/article/60/compiling-installing-xdebug-for-php-525-entropych-build-on-os-x-105

Installing MySQL

Use the installer from MySQL’s site, and it goes pretty seamlessly. You may have to edit the php.ini to use the mysql server.

The tricky part of this is if you use a framework, or your code uses the pdo database interface. Again, you can try my 64-bit version, or compile your own pdo_mysql extension. Enable the extension in the php.ini by addin gthe line extension=pdo_mysql.so

pdo_mysql.so (specific to 64-bit Mac OS X)

http://www.hoboes.com/Mimsy/hacks/adding-pdo-mysql-mac-os-x-leopard-server/
http://www.spiration.co.uk/post/1332/install%20PDO_MYSQL%20-%20mysql_config%20and%20header%20files%20problem

Eclipse

So there is a Cacao version that is 64-bit. I guess the difference here, as I’ve read online, is that the Carbon version is more stable, but also legacy and in the future will be deprecated soon.

I love using the update site to get plugins. That seemed to work best for PDT php, aptana, SVN (subclipse), and various editors, etc.

Flex

I sort of copped-out here when I learned the 64-bit version of eclipse doesn’t work well with Flex-Builder as an Eclipse plugin. I’m planning on installing the stand-alone version of flex builder, and using that separately (a little but resource wasteful, but far more convenient).

Add A Comment