Install MySQL 5
First of all install the MySQL 5, a relational database management system (RDBMS) that runs as a server in order to endow a number of databases with a multi-user access. In order to install the MySQL 5 in your system, simply do this:
yum install mysql mysql-server
After that, you have to create the system startup links for MySQL and just set up the MySQL server:
chkconfig --levels 235 mysqld on
Now, it is the time to install Apache2, which is easily available as a CentOS package. Therefore, you can install it in this manner:
yum install httpd
At this time, organize you system in order to start the Apache at boot time:
hkconfig --levels 235 httpd on
Now, start Apache like this:
After that, direct your browser to http://192.168.0.100, and you should see the Apache2 placeholder page as shown in the image on your right hand side.
Note: The Apache's default document root is /var/www/html on CentOS and the configuration file is /etc/httpd/conf/httpd.conf. Secondly, the extra configurations are stored up in the /etc/httpd/conf.d/ directory.
Set up PHP5
The method for installing the PHP5 and the Apache PHP5 module is as given below:
yum install php
Make sure to restart Apache subsequently:
Test PHP5 and get details about its Installation
Now, test the installed PHP5 and get details about its Installation. Do not forget that the document root of the default web site is /var/www/html. You can now simply generate a small PHP file in the directory and directly call it in a browser that is useful in putting lots of useful details about our PHP installation on show; including the installed PHP version etc. You can create the PHP file by:
Simply call the generated file in a browser (e.g. http://192.168.0.100/info.php). Look into the image on right side for more information.
You will notice that the PHP5 is working through the Apache 2.0 Handler, clearly shown in the Server API line. Roll further down in order to check out the modules that are by now functionion in PHP5.
If you do not find the MySQL listed there, it means that you do not have the MySQL support in PHP5 yet.
Get the MySQL Support in PHP5
Now, you have to get the MySQL Support in PHP5. The installation of the php-mysql package is must for this purpose. Therefore, it is good to put in some other PHP5 modules. Follow the given below method to search for available PHP5 modules:
yum search php
Pick the PHP5 modules according to your requirement and install them like this:
yum install php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc
It is the time to restart Apache2 by:
Move on and reload http://192.168.0.100/info.php in your browser and then scroll down to the modules section for another time.
You will now come across lots of new modules there, together with the MySQL module, as show in the picture.
Manage your MySQL databases through phpMyAdmin
phpMyAdmin is basically a free software tool written in PHP, which is planned to take care of the administration of MySQL over the World Wide Web. It is actually a web interface, which helps in handling your MySQL databases.
phpMyAdmin is not on hand in the official CentOS 6.1 repositories; therefore, you have to enable the RPMforge repository on your CentOS system.
Initially, import the RPMforge GPG key like this:
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Your phpMyAdmin can now be installed as given below:
yum install phpmyadmin
Go ahead and put together phpMyAdmin. Now, modify the Apache configuration so that the phpMyAdmin permits connections not just from local host:
After that you have to modify the authentication in phpMyAdmin from cookie to http:
Start Apache again by:
Then, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/.