Compile Apache+MySQL+php on Snow Leopard

started at 27 Sep 2009 by zerustech
  • zerustech
    27 Sep 2009

    Hi Guys,

    I was trying to compile Apache+MySQL+PHP on Snow Leopard according to the instructions on this website, but unfortunately none of them worked.

    I tried different solutions and finally succeeded. So I'm just posting the instructions here and hopefully it will be helpful to you.

    1. First of all, you should download apache 2.2.13 (the apxs in its previous releases does not work)

    2. Install xcode from Snow Leopard installation DVD (I guess you have already installed)

    3. Install MacPorts and the following port libs:
    - zlib
    - curl
    - xsl
    - gd
    - openjpeg
    - libpng
    - freetype
    - xpm
    - exif
    - libiconv

    4. Compile MySQL (5.1.39) as follows:

    #!/bin/sh
    MYSQLVERSION="5.1.39"
    MYSQLDIR="/opt/mysql/$MYSQLVERSION"
    make distclean
    ./configure \
    --prefix=$MYSQLDIR \
    --with-server-suffix=--standard \
    --enable-thread-safe-client \
    --enable-local-infile \
    --enable-shared \
    --with-zlib-dir=bundled \
    --with-big-tables \
    --with-readline \
    --with-plugins=all \
    --with-mysqld-user=mysql \
    --with-extra-charsets=all \
    --with-unix-socket-path=$MYSQLDIR/var/mysql.sock \
    --without-docs
    make
    make install

    5. Compile Apache (2.2.13) as follows:
    #!/bin/sh
    APACHEVERSION="2.2.13"
    APACHEDIR="/opt/apache/$APACHEVERSION"
    make distclean
    ./configure -prefix=$APACHEDIR \
    -enable-mods-shared=all \
    -with-ssl \
    -with-mpm=prefork \
    -disable-unique-id \
    -enable-ssl \
    -enable-dav \
    -enable-cache \
    -enable-proxy \
    -enable-logio \
    -enable-deflate \
    -with-included-apr \
    -enable-cgi \
    -enable-cgid \
    -enable-suexec

    6. Compile PHP (4.4.9 or 5.3.0) as follows:
    #!/bin/sh
    PHPVERSION=4.4.9
    MYSQLVERSION=5.1.39
    APACHEVERSION=2.2.13
    BUILDTAG=$PHPVERSION.mysql.$MYSQLVERSION
    PHPDIR=/opt/php/$BUILDTAG
    MYSQLDIR=/opt/mysql/$MYSQLVERSION
    make distclean
    ./configure \
    --prefix=$PHPDIR \
    --with-apxs2=/opt/apache/$APACHEVERSION/bin/apxs \
    --with-config-file-path=$PHPDIR/etc \
    --with-mysql=$MYSQLDIR \
    --with-mysqli=$MYSQLDIR/bin/mysql_config \
    --with-pdo-mysql=$MYSQLDIR \
    --with-zlib=/opt/local \
    --with-curl=/opt/local \
    --with-mcrypt=/opt/local \
    --with-xsl=/opt/local \
    --with-gd=/opt/local \
    --with-jpeg-dir=/opt/local \
    --with-png-dir=/opt/local \
    --with-zlib-dir=/opt/local \
    --with-xpm-dir=/opt/local \
    --with-freetype-dir=/opt/local \
    --with-iconv=/opt/local \
    --enable-mbstring \
    --enable-exif \
    --enable-cli \
    --enable-pcntl \
    --enable-sockets \
    --enable-ftp \
    --enable-soap
    export EXTRA_CFLAGS="-lresolv"
    make
    make install

  • Richard
    27 Sep 2009

    Hi, I don't know why you think the instructions here don't work. They do, there is a whole separate section that describes compiling on Snow Leopard: http://diymacserver.com/installing-everything-on-snow-leopard/

    Maybe you didn't look at the correct place?

  • zerustech
    27 Sep 2009

    Hi Richard,

    I think the problem is: looks like it's only possible to compile php with apache 2.2.13 on snow leopard. I tried to compile php with apache 2.2.4 and 2.0.55, but the "apxs" didn't work.

    So can you please update your instruction and close this ticket?

    Kind regards

  • Richard
    28 Sep 2009

    No problem, why are you using apache 2.2.4? It's not even the default installed version on Snow Leopard (2.2.11).

    The instructions are meant as a complete set and I'm assuming everyone is using the latest version. Checking all components with all possible older versions is not something I'm even considering ;-)

    Consider this a closed ticket....

Reply

You must log in to post.