inicio pictures? mail me! my life? sindicaci;ón

Compiling Apache+MySQL+PHP on MacOSX 10.5

Over the past few weeks, maybe months I have been trying to get a nice webserver running on my Mac. Now I have done this before, but this time I tried to add Oracle Instant Client into the mix and ended up with a failed configure.

After a few trial, errors, and reading through the config.m4 file for pdo_oci I have finally found my problem. PHP was not meant to be built on the Mac at all. It only looks for the Linux libraries. So without having to write a patch file for the pdo_oci extension, I simply made a symbolic link to the mac version of the library it was looking for, but using the link .so name instead. And you know what, it worked out great.

Requirements:
Extract the following to a folder:
MySQL -> http://dev.mysql.com
Oracle Instant Client -> http://www.oracle.com

Extract and compile the following:
./configure
make
sudo make install

FreeType -> http://freetype.sourceforge.net/
Gettext -> http://www.gnu.org/software/gettext/
Gmp -> http://gmplib.org/
Jpeg -> http://www.ijg.org/
Libmcrypt -> http://sourceforge.net/projects/mcrypt/
Libpng -> http://sourceforge.net/projects/libpng/
mhash -> http://sourceforge.net/projects/mhash/
icu (for PHP 6) -> http://www.icu-project.org/

Compiling Apache:

insert into config.layout

<Layout Obasi3>
prefix:        /usr/local/httpd-2.2.9
exec_prefix:   ${prefix}
bindir:        ${exec_prefix}/bin
sbindir:       ${exec_prefix}/sbin
libdir:        ${exec_prefix}/lib
libexecdir:    ${exec_prefix}/modules
mandir:        ${prefix}/man
sysconfdir:    ${prefix}/conf
datadir:       ${prefix}
installbuilddir: ${datadir}/build
errordir:      ${datadir}/error
iconsdir:      ${datadir}/icons
manualdir:     ${datadir}/manual
htdocsdir:     ${datadir}/htdocs
cgidir:        ${datadir}/cgi-bin
includedir:    ${prefix}/include
localstatedir: ${prefix}
runtimedir:    ${localstatedir}/logs
logfiledir:    ${localstatedir}/logs
proxycachedir: ${localstatedir}/proxy
</Layout>


./configure \
--enable-layout=Obasi3 \
--enable-mods-shared=all \
--with-ssl=/usr \
--with-mpm=prefork \
--enable-ssl \
--enable-dav \
--enable-cache \
--enable-proxy \
--enable-logio \
--enable-deflate \
--with-included-apr \
--enable-cgi \
--enable-cgid \
--enable-suexec


make
sudo make install
sudo ln -s /usr/local/httpd-2.2.9 /Library/Apache2
sudo ln -s /usr/local/httpd-2.2.9 /usr/local/apache

Compiling PHP:

sudo ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

ORACLE_BASE="/usr/local/instantclient-10.2.0.4"
ORACLE_HOME="${ORACLE_BASE}"
ORACLE_SID=mydev
export ORACLE_BASE ORACLE_SID ORACLE_HOME

DYLD_LIBRARY_PATH="${ORACLE_HOME}"
LD_LIBRARY_PATH="${ORACLE_HOME}"
LIB_PATH="${ORACLE_HOME}"
export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIB_PATH

PATH="${PATH}:${ORACLE_HOME}"
export PATH

sudo ln -s $ORACLE_HOME/libclntsh.dylib.10.1 $ORACLE_HOME/libclntsh.dylib
sudo ln -s $ORACLE_HOME/libclntsh.dylib.10.1 $ORACLE_HOME/libclntsh.so
sudo ln -s $ORACLE_HOME/libocci.dylib.10.1 $ORACLE_HOME/libocci.dylib


./configure \
--prefix=/usr/local/php-5.2.6 \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-config-file-path=/usr/local/etc/php5 \
--with-apxs2=/usr/local/apache/sbin/apxs \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-sockets \
--enable-mbregex \
--enable-mbstring=all \
--enable-ftp \
--enable-exif \
--with-openssl \
--with-zlib-dir=/usr \
--with-zlib \
--enable-magic-quotes \
--enable-bcmath \
--without-cdb \
--with-gd \
--with-freetype-dir \
--without-msql \
--with-pdo-mysql \
--with-iodbc \
--enable-inline-optimization \
--enable-dba \
--without-gdbm \
--with-ndbm \
--without-db2 \
--without-dbm \
--without-readline \
--without-recode \
--with-mcrypt \
--without-db3 \
--enable-dba \
--with-curl \
--with-png-dir=/usr/local/lib \
--with-jpeg-dir=/usr/local/lib \
--enable-calendar \
--with-mhash \
--with-xsl \
--with-bz2 \
--with-gmp \
--with-iconv \
--with-libxml-dir \
--with-gettext \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl-dir=/usr \
--with-mime-magic \
--with-oci8=instantclient,/usr/local/instantclient-10.2.0.4 \
--with-pdo-oci=instantclient,/usr/local/instantclient-10.2.0.4,10.1


make
sudo make install
sudo ln -s /usr/local/php-5.2.6 /usr/local/php

sudo cp ./php.ini-recommended /usr/local/etc/php5/php.ini

edit “/usr/local/apache/sbin/envvars”
insert:
DYLD_LIBRARY_PATH=”/usr/local/instantclient-10.2.0.4:/usr/local/httpd-2.2.9/lib:$DYLD_LIBRARY_PATH”

edit: “/usr/local/apache/conf/httpd.conf”
insert:
DirectoryIndex index.html index.php
# PHP Settings
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

And you are all set to start up the Server.


sudo /usr/local/apache/sbin/apachectl start

Comments are closed.

Close