Apache with PHP Step 1 : Install packages for apache and php [root#] yum install httpd* [root#] yum install php* Step 2 : Verify the packages of apache [root#] rpmquery -qa | grep httpd o/p: httpd-2.2.15-5.el6.i686 httpd-tools-2.2.15-5.el6.i686 httpd-devel-2.2.15-5.el6.i686 httpd-manual-2.2.15-5.el6.noarch Step 3 : Check file "php.ini" [root#] cd /etc [root#etc] ls [root#etc] cd /root Step 4 : Get the hostname [root#] hostname o/p: server.tyit.com Step 5: Get the IPAddress [root#] ifconfig o/p: 192.168.2.111 Step 6 : Using GUI navigate to directory "/var/www" 6.1 Create a directory "virtual" inside this -- already created 6.2 Create a page "b.php" inside virtual and write following : This is test php page

Testing apache with PHP


Step 7: Open the configuration file "/etc/httpd/conf/httpd.conf" Go to end of file : # # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common # ServerAdmin root@server.tyit.com DocumentRoot /var/www/virtual ServerName server.tyit.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common ** Save the file and come to terminal Step 8 : Give full permissions to virtual directory [root#] chmod -R 777 /var/www/virtual Step 9: Stop the firewall [root#] service iptables stop Step 10: Start and restart apache service [root#] service httpd start [root#] service httpd restart Step 11 : Make the service enable at boot time [root#] chkconfig httpd on Testing Open the Firefox browser and write in URL : http://192.168.2.111/ http://192.168.2.111/b.php