Before install Apache2, PHP5 and MySQL, install CentOS 6.3 server first.
Followed the steps to install these staff.
1) Installing MySQL 5

yum install mysql mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Set passwords for the MySQL root account:

mysql_secure_installation

Follow the prompt to add password to root.
2) Installing Apache2

yum install httpd

Now configure your system to start Apache at boot time…

chkconfig --levels 235 httpd on

… and start Apache:

/etc/init.d/httpd start

3) Installing PHP5
We can install PHP5 and the Apache PHP5 module as follows:

yum install php

We must restart Apache afterwards:

/etc/init.d/httpd restart

4) Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install the php-mysql package. It’s a good idea to install some other PHP5 modules as well as you might need them for your applications.

yum install php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc

Now restart Apache2:

/etc/init.d/httpd restart

Now, LAMP is ready to use.

David Yin

David is a blogger, geek, and web developer — founder of FreeInOutBoard.com. If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *