OAMP is stands for
OpenBSD
Apache
MySQL and
PHP.
In this blog, I'm trying to use the latest version on each software, however for PHP I'll use 5.3.x instead of 5.4.x, since it has some issue make the PHP 5.4.x not able to be compiled on openBSD. I'll use the MySQL which comes comes from openBSD it self.
However, this tutorial will works on Linux machine as well.
1.First download all the tarball first.
#mkdir -p /usr/local/source
#cd /usr/local/source
#wget http://apache.mirror.rafal.ca//httpd/httpd-2.4.3.tar.gz
#wget http://www.php.net/get/php-5.3.17.tar.gz/from/a/mirror
2.Once it's done, untar both of the tarballs, by executing the command below:
#tar -xzvf httpd-2.4.3.tar.gz
#tar -xzvf php-5.3.17.tar.gz
#cd httpd-2.4.3
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic
#make && make install
#cd ../php-5.3.17
#./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --enable-zip --with-gettext --with-curl
#make && make install
3.Copy and edit the following file
#cp -p .libs/libphp5.so /usr/local/apache/modules
#cp -p php.ini-recommended /usr/local/apache/php/php.ini
vi /usr/local/apache2/conf/httpd.conf
---
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
DirectoryIndex index.html index.php
AddType text/html .php
---
4.Edit the following files
#cd /usr/sbin/
#mv apachectl{,.bakcup}
#mv httpd{,.bakcup}
#ln -s /usr/local/apache2/bin/apachectl /usr/sbin/apachectl
#ln -s /usr/local/apache2/httpd /usr/sbin/httpd
#vi /etc/rc.conf
---
...
httpd_flags=""
...
---
5. Test the apache configuration and run it.
#/etc/rc.d.d/apache configtest
#/etc/rc.d/apache restar