Working with PHP 5 in Mac OS X 10.5  PDF Print E-mail
Tag it:
Delicious
Furl it!
Digg
NewsVine
Reddit
YahooMyWeb
Technorati
Articles Reviews PHP
Written by Adi Bach   
Monday, 29 October 2007

Mac OS X is a great development platform for working with PHP. Leopard comes with Apache, PHP and many other development tools, such as subversion already installed. Leopard brings a much needed upgrade from Tiger's tired PHP 4 to a very modern version of PHP 5.2.4. This is a guide for setting up a PHP development environment under 10.5 using the version of PHP that ships with leopard.



You may prefer to use one of the 3rd party distributions of PHP, such as MAMP, XAMPP or Marc Liyanage. This is a guide to using the version of PHP that comes with 10.5.

Enable Developer Tools

First, enable your root password. You may also want to install XCode Tools from your Leopard disk (or grab the latest from Apple developer tools). The tools are required is you are going to compile any extensions for PHP.

Editing Configuration Files

We will have to edit several configuration files that exist as part of the unixy underpinnings of OS X. I'm going to recommend the free text editor, TextWrangler for this purpose. Normally, the finder hides the configuration files from view. However, in the finder, you can use the "Goto Folder..." option under the "Go" menu to view these files. This option if available via command-shift-G. Actually, this option is available in any file open dialog in OS X via command-shift-G. In addition, Text Wrangler will allow you to browse these files with its "open hidden..." option. But, the much easier option is selecting "Open file by name..." (command-D) and just typing the full path and filename. To save many of these files, you will need to enter your root password. Be Careful.

Enabling PHP

PHP is installed in Mac OS X by default, but not enabled. To enable it, we must edit the apache 2 configuration file, which is located at /etc/apache2/httpd.conf. Find the line which loads the PHP 5 module, which looks like this:

#LoadModule php5_module libexec/apache2/libphp5.so

The line is currently commented out. All we have to do is remove the comment symbol, #, so the line looks like this:

LoadModule php5_module libexec/apache2/libphp5.so

Save.

Starting Apache

Go to the sharing panel in system preferences and enable "Web Sharing." This will start the apache server.

Read more


User reviews

There are no user reviews for this item.

Add new review




Powered by jReviews

Last Updated ( Saturday, 20 September 2008 )
 
< Prev   Next >