Installing Apache 2.2 and PHP 5.4 on OS X

Comments

What I did to install Apache HTTP server 2.2 and PHP 5.4 on OS X Snow Leopard.

I actually wanted to install 2.4 but it seems to be broken

1
2
3
4
5
6
7
$ cd ~/Downloads/httpd-2.2.22/
$ ./configure \
--prefix=/usr/local/bin/apache2 \
--enable-rewrite \
--enable-actions \
--enable-so \
--with-included-apr
  • Built with make
1
$ sudo make install
  • Download PHP 5.4.1 and double click on it to extract it

  • installed a couple of useful packages using

1
2
3
4
$ sudo brew update
$ sudo brew install libpng
$ sudo brew install libjpeg
$ sudo brew install pcre
  • In the directory where I download the PHP sources, I run configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$ cd \~/Downloads/php-5.4-1.0/
$ ./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/local/bin/apache2/bin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--with-freetype-dir=/usr/X11/ \
--with-jpeg-dir=/usr/X11/ \
--with-png-dir=/usr/X11/ \
--enable-gd-native-ttf \
--with-icu-dir=/usr \
--with-iodbc=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--without-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets\
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pcre-regex=/usr
  • Copied the httpd-vhost.conf file from my older http server to the latest one

  • Started apache

1
$ sudo /usr/local/bin/apache2/bin/apachectl -k start
  • Checked php version with php --version

It all seems to work well.

Comments