DIY MAMP - build Apache for Mac OS X

    This habratopik will be from a series on how to organize MAMP (Mac OS X + Apache + MySQL + PHP) for Mac OS X

    with your own hands. Let's start with updating Apache 2.

    I think users of Mac OS X Leopard know that Apache (version 2, starting from 10.5.2) and so comes bundled with the operating system. But this does not mean at all that the ability to independently upgrade your Apache is useless.

    Note: in order for you to succeed, you need to install Developer Tools

    Since the organization of files, etc. on Mac OS it differs from that adopted in other Unix systems (I equal them because we will work through the terminal) and the location of the files of the same preinstalled Apache differs from the standard one, I will give instructions on how to update the web server, without creating its extra copies and retaining the function of managing it through Sharing in System Preferences.

    So let's get started. To get started, download the latest version of Apache source code (at the time of writing habratopika - 2.2.8) - here (I’ll clarify, we need Unix Source - here’s a direct link ).

    We unpack it somewhere in a safe place (I note that we will not remove these sorts, on the contrary, they will lie with us for the subsequent addition of components with the least efforts - if necessary).

    Open Terminal (Utilities folder in Applications). Tulim to that folder with a command, let's say it lies in the src folder, in the user's home folder:
    cd ~/src/httpd-2.2.8

    In this folder, open config.layout and append the following to the end: This is the layout of the web server files on our machine. It clearly follows the layout of the native Apache, which is installed by Leopard. Next, create the conf.args file here:
    prefix: /usr
    exec_prefix: ${prefix}
    bindir: ${exec_prefix}/bin
    sbindir: ${exec_prefix}/sbin
    libdir: ${exec_prefix}/lib
    libexecdir: ${exec_prefix}/libexec+
    mandir: ${prefix}/share/man
    sysconfdir: /etc+
    datadir: /Library/Webserver
    installbuilddir: ${prefix}/share/httpd/build
    errordir: ${prefix}/share/httpd/error
    iconsdir: ${prefix}/share/httpd/icons
    htdocsdir: ${datadir}/Documents
    manualdir: ${datadir}/share/httpd/manual
    cgidir: ${datadir}/CGI-Executables
    includedir: ${prefix}/include+
    localstatedir: /var
    runtimedir: ${localstatedir}/run
    logfiledir: ${localstatedir}/log+
    proxycachedir: ${runtimedir}/proxy

    ./configure \
    --enable-layout=Leopard \
    --enable-mods-shared=all \
    --with-mpm=prefork \
    --disable-static \
    --disable-unique-id \
    --disable-ipv6 \
    --enable-dav \
    --enable-cache \
    --enable-proxy \
    --enable-shared \
    --enable-logio \
    --enable-deflate \
    --with-included-apr \
    --enable-cgi \
    --enable-cgid \

    This is a configuration command that will prepare the sources for compilation for your system and determine the file layout (--enable-layout = Leopard). In addition, there are indicated additional settings that I personally use locally. If you need something else or something is not necessary - it is subject to editing.
    We put it in a file so that when something needs to be supplemented or changed, there was a previous configuration option.

    All that remains to be done is to execute the configuration command - copy it entirely from the file, paste it into the console and press enter. It will take some time and the team will finish working out.

    Then we perform:
    We wait, and after:
    sudo make install

    In general, the server is updated. :) Later I will add how to add it to startup.

    And yet, I often mentioned that in the future it will be possible to remove or add components - this is done simply. For the same cases we apply .configure with new parameters, then make and sudo make install. The advantage that you will do it again for the same reasons is that the configuration and make will be much faster.

    Also popular now: