Google

Tuesday, February 12, 2008

LAMP Server configuration on Centos

Installing LAMP Server on Centos

1).Check /etc/hosts and make sure the host name is setup
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.10.10.1 www.example.com

2).Now install all the packages required to have a LAMP server.

yum install perl-DBD-MySQL mysql-server mysql php-mysql mod_auth_mysql openssl mod_ssl php

httpd perl-CPAN

3.After installation, we will want to make the all the programs start for future reboots and

start them right now ... to do that, use the following commands:

chkconfig httpd on
chkconfig mysqld on

Here is how to start them now ....

/etc/init.d/mysqld start
/etc/init.d/httpd start

4).Now test the server if its working by adding a page called info.php to the root directory of my site to make sure everything is working. Edit a file named /var/www/html/info.php and write php code inside the file or type phpinfo() inside the php tags:

5).Now open a web browser and go to your website via either it's name or ip address,

http://www.example.com/info.php

or

http://10.10.10.1/info.php

6).Add this to http.conf

/etc/httpd/conf/httpd.conf


Find the AddType section and uncomment these lines:

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

Now find the DirectoryIndex section and add some info for php. It should look like this:

DirectoryIndex index.html index.phtml index.php index.phps

That should do it. Now restart the Apache http daemon:

killall -HUP httpd