• Happy Coding

manual of the day… Install PHP5, Apache2 on Mac OS X

Install PHP5, Apache2 on Mac OS X

Install Apache in /usr/local/apache2

$ curl http://apache.linux-mirror.org/httpd/httpd-2.2.4.tar.gz -O

$ tar xvfz httpd-2.2.4.tar.gz

$ cd httpd-2.2.4

# ./configure --prefix=/usr/local/apache2/ --enable-module=most --enable-shared=max

# make

# make install

Install PHP in /usr/local/apache2/php
(Assumption: MySQL in /usr/local/mysql)


Download a new version of PHP at http://www.php.net/downloads.php (here: 5.2.3)

$ tar xvfz php-5.2.3.tar.gz

$ cd php-5.2.3
# mkdir /usr/local/apache2/php

# ./configure --prefix=/usr/local/apache2/php --with-zlib --with-xml --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql

# make

# make test

# make install

Edit /usr/local/apache2/conf/httpd.conf and add

LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

DirectoryIndex index.html index.php


If you want to change the DocumentRoot of the Webserver from the standard /usr/local/apache2/htdocs to some other directory, change in the httpd.conf file

DocumentRoot "/usr/local/apache2/htdocs"

and

<Directory "/usr/local/apache2/htdocs">

to your favored directory.

Start the server

# /usr/local/apache2/bin/apachectl start
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Ma.gnolia
  • MisterWong
  • Reddit
  • SphereIt
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yigg
  • LinkedIn
  • Print this article!
  • Tumblr
  • Pownce
Share your opinion! Post your thoughts.