Installing Apache, MySQL and PHP 5.3.5 with gd, curl, ereg, mcrypt and zlib on Mac OS X 10.5 from source

June 6th, 2011 by Regaz

Make a directory to keep all your sources and give it the right permissions:

mkdir $HOME/src
chmod 750 $HOME/src

1)You need to start by installing apache:

cd $HOME/src
wget http://www.motorlogy.com/apachemirror//httpd/httpd-2.2.19.tar.gz
tar xzvf httpd*tar.gz
cd httpd*
./configure --prefix=/usr/local/apache2
make
sudo make install

You need to wait for a will until the process will be achieved…
After to be installed it’s Fundamental for Security to give Apache the Right Permissions(Setting Permissions in Apache):

sudo chown -R root:admin /usr/local/apache2
su root -c "find /usr/local/apache2 -type d | xargs chmod 755"
su root -c "find /usr/local/apache2 -type f | xargs chmod 744"

2) Install MySQL

Look to MyArticle for Installing from Source the New MySQL Version Oracle:
http://howto.sviluppo-siti-web.com/content/installing-mysql-5520-source-mac-os-x-105-leopard-106-snow-leopard-and-107-lion

3) Install needed PHP’s Libraries

a) Install libjpeg (Reference)

wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
tar xzvf jpegsrc.v8b.tar.gz
cd jpeg-8b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local/libjpeg
make
sudo mkdir -p /usr/local/libjpeg/include
sudo mkdir /usr/local/libjpeg/lib
sudo mkdir /usr/local/libjpeg/bin
sudo mkdir -p /usr/local/libjpeg/man/man1
sudo make install

Finally the Notice of Successful Libraries installation will say:

Libraries have been installed in:
/usr/local/libjpeg/lib

b) Install libpng (Reference)

Download Latest libpng15:

Libpng 1.5.x tar.gz
cd /path/To/libpng*
cp scripts/makefile.darwin Makefile
./configure --enable-shared --prefix=/usr/local/libpng
make
sudo make install

For to make things a little bit easier you need to have installed and working Macports

c) Install curl

sudo port install curl

d) Install mcrypt

sudo port install mcrypt

e) Install zlib

wget http://zlib.net/zlib-1.2.7.tar.gz
tar xvzf zlib*
cd zlib*
./configure
make
sudo make install

f) Install libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvzf libiconv*
cd libiconv*
./configure
make
sudo make install

g) Install freetype

sudo port install freetype

i) Install gd

wget http://ring.nict.go.jp/archives/graphics/gd/gd-2.0.36RC1.tar.gz
tar xvzf gd*
cd gd*
ln -s `which glibtool` ./libtool
./configure
sudo mkdir /usr/local/include
sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include/fontconfig
make
sudo make install

4) Download, Configure and Install PHP

wget http://museum.php.net/php5/php-5.3.5.tar.gz

If the Link doesn’t works look in:
http://php.net/releases/index.php

tar xvzf php*
cd php*
./configure --prefix=/usr/local \
--mandir=/usr/local/share/man --infodir=/usr/local/share/info \
--sysconfdir=/usr/local/etc --enable-cli --enable-exif \
--enable-ftp --enable-mbstring --enable-mbregex --enable-sockets \
--enable-zip --with-apxs2=/usr/sbin/apxs --without-pear \
--with-ldap=/usr --with-kerberos=/usr --with-zlib-dir=/usr 
--with-iodbc=/usr --with-curl=/opt/local --with-config-file-path=/etc \
--with-mysql-sock=/tmp --with-mysqli=mysqlnd --with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql/bin/mysql_config \
--with-jpeg-dir=/usr/local/libjpeg --with-freetype-dir=/opt/local \
--with-png-dir=/usr/local/libpng --with-gd --with-iconv=/usr/local \
--with-xmlrpc --with-xsl=/usr --with-libxml-dir=/usr \
--with-mcrypt=/opt/local

(The most Relevant setting to consider is –with-mysqli=mysqlnd because it
Resolve a Mysql BUG of MySQL 5.1.5)

make
sudo make install

Tags: , , ,