Friday, June 23, 2006

APMP-ApachePhpMysqlPostgresql Installation

1.Introduction

This post describes the installation of PostgreSQL-8.0.3 , Mysql-4.1.12 , Apache-2.0.54 and PHP 5.0.5 . from the source code distribution.

Command details to open

#tar -xvzf <tar.gz file>
#tar -xvjf <tar.bz2 file>

x -Extract
v-Verbose
z-for gnu zip file
j-for bz file
f-use archieve file

1. PostgreSQL Installation.

$ ./configure
(Note:--without-readline
Prevents use of the Readline library. This disables command-line editing and history in psql, so it is not recommended.If the configuration stop and show the readline error,
use this option.)
$ gmake
$ su
$ gmake install
$ useradd postgres
$ mkdir /usr/local/pgsql/data
$ chown postgres /usr/local/pgsql/data
$ su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
$ /usr/local/pgsql/bin/createdb test
$ /usr/local/pgsql/bin/psql test8


2.Mysql Installation.

$ groupadd mysql
$ useradd -g mysql mysql
$ gunzip < mysql-VERSION.tar.gz | tar -xvf -
$ cd mysql-VERSION
$ ./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 &


3.Apache Installation

$ ./configure --prefix=PREFIX --enable-module=so
$ make
$ make install
$ PREFIX/bin/apachectl start


Replace PREFIX with the filesystem path under which
Apache should be installed. A typical installation
might use "/usr/local/apache2" for PREFIX (without the
quotes).

--enable-module=so This is for accept the modules as Shared Module.


4.PHP Installation.

$./configure --with-mysql=<mysql path>
--with-pgsql=<pgsql path>
--with-apxs2=<apx path>
--with-config-file-path=/usr/local/apache2/
--with-zlib

Mostly the paths will be

mysql path=/usr/local/mysql/
pgsql path=/usr/local/pgsql/
apx path= /usr/local/apache2/bin/apxs

Note:
--with-config-file-path=/usr/local/apache2/
This is used to set the path for php.ini.(if you want to change the default location (/etc/php.ini) use this option)

$ make
$ make install

If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.

5.Configure Apache and php.ini

Setup your php.ini file:

$ cp php.ini-dist /usr/local/lib/php.ini

You may edit your .ini file to set PHP options.

Edit your httpd.conf to load the PHP module. The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have already
added this for you, but be sure to check.
For PHP 4:
LoadModule php4_module libexec/libphp4.so
For PHP 5:
LoadModule php5_module libexec/libphp5.so

Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.

AddType application/x-httpd-php .php .phtml

It's also common to setup the .phps extension to show highlighted PHP
source, this can be done with:

AddType application/x-httpd-php-source .phps


Reference :


1.http://www.apache.org

2.http://dev.mysql.com

3.http://php.net

4.http://www.postgresql.org



technorati tags:, , , ,

1 comment:

selva said...

Hi Bala,

Good Article helpful in installing...

Keep up the good work.