Apache2, MySQL 4.1 and PHP5

I started out tonight to install a parallel Apache2 and PHP5 on the laptop, to complement the existing Apache/PHP4 install. And I thought I would keep notes as I did it, maybe turn it into an extended blog entry, “Man Conquerors Technology” and all that, you know the type. Who knows, if it really got hairy, maybe I could make into an article for O’reilly. My scholarly ambitions were foiled once again; the software was just too damn easy to install

Install Mysql 4.1

From MySQL source

> groupadd mysql
> useradd -g mysql mysql
> ./configure --prefix=/usr/local/mysql
> make
> make install
> cp support-files/my-medium.cnf /etc/my.cnf
> cd /usr/local/mysql
> bin/mysql_install_db --user=mysql
> chown -R root  .
> chown -R mysql var
> chgrp -R mysql .
> bin/mysqld_safe --user=mysql &

Post installation

> mysql -u root
> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd')

Build Apache2

> ./configure --enable-mods-shared=ALL --prefix=/usr/local/apache2
> make
> make install

Updated July 2006:

> ./configure \
--enable-mods-shared=ALL \
--prefix=/usr/local/apache2 \
--enable-proxy \
--enable-rewrite \
--enable-so
> make
> make install

Updated July 2008:

> ./configure \
--enable-mods-shared=ALL \
--prefix=/usr/local/apache2 \
--enable-proxy \
--enable-rewrite \
--enable-so \
--enable-deflate
> make
> make install

Then tweak the conf file a bit. UserDirs should be set to Sites for example. Probably want to set User/Group to www/www. Also note that Port has been totally superceeded by Listen.

Build PHP5

> apt-get install libxml2
> apt-get install libxml2-dev
> apt-get install flex
> apt-get install libpng3
> apt-get install libpng3-dev
> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-libxml \
  --prefix=/usr/local/php5 --with-zlib --with-gd --enable-soap --enable-sockets
> make
> make install

You also have to add the line AddType application/x-httpd-php .php
to the /usr/local/apache2/conf/httpd.conf.

Part of this article is written by laughingmeme.org


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!