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
tar xzvf httpd*tar.gz
cd httpd*
./configure --prefix=/usr/local/apache2
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:

3) Install needed PHP’s Libraries

a) Install libjpeg (Reference)

tar xzvf jpegsrc.v8b.tar.gz
cd jpeg-8b
ln -s `which glibtool` ./libtool
./configure --enable-shared --prefix=/usr/local/libjpeg
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:

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
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

tar xvzf zlib*
cd zlib*
sudo make install

f) Install libiconv

tar xvzf libiconv*
cd libiconv*
sudo make install

g) Install freetype

sudo port install freetype

i) Install gd

tar xvzf gd*
cd gd*
ln -s `which glibtool` ./libtool
sudo mkdir /usr/local/include
sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include/fontconfig
sudo make install

4) Download, Configure and Install PHP


If the Link doesn’t works look in:

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 \

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

sudo make install

Tags: , , ,