CentOS Server Set Up - Installing php

Manager's picture

1. Installing php

yum install php

2. Restart Apache

/etc/init.d/httpd restart

3. Test php install

vi /var/www/html/info.php

4. Add code

<?php
phpinfo();
?>

5. Check Install

http://localhost/info.php

You will see, PHP is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. MySQL is not listed there which means we don't have MySQL support yet.

6. 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. You can install available PHP modules like this:

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

7. Restart Apache

/etc/init.d/httpd restart

8. phpMyAdmin

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i...
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.i386.rpm

9. Install phpMyAdmin as follows

yum install phpmyadmin

10. Configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost

vi /etc/httpd/conf.d/phpmyadmin.conf

11. Comment out

#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#

12. Change the authentication in phpMyAdmin from cookie to http

vi /usr/share/phpmyadmin/config.inc.php

13. Change to the below

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

14. Restart Apache

/etc/init.d/httpd restart

15 Log into phpmyadmin

localhost/phpmyadmin

using root / password for mysql