06 November 2011

How to install apache and php on Linux Red Hat 64 bit

In order to enable server listen web requests, we need to install apache on server
Following steps have been performed on linux red hat 64 bit operating system 
1:- First login as root on server through Putty
 
2:- Perform yum installation of apache (Yum is an automatic updater and  package installer/remover for rpm systems) 
   Type following commands
 # yum install httpd httpd-devel 
 
After installation test your installation by executing following command
 
# service httpd start
With this, your apache has been successfully started.
 
3:- Configure APACHE
 For this, we have to edit httpd.conf file located at /etc/httpd/conf/http.conf
 
Type following command
 # sudo nano httpd.conf
 
Now edit following entry
Servername IP ADDRESS:80
 
Now restart your server, type following command
 # service httpd restart
 Your apache installation is complete now
 
2:- Install PHP
 
1:- Type following command
 
# yum install php
With this your PHP have been installed on server
 
2:- Create a file named index.php where by default apache will point to
 
Type following commands
 
# cd /var/www/html
# sudo nano index.php
 
Now type following code inside it 
<?php phpinfo(); ?> 
and Save it 
 
3:- Restart apache
 
# service httpd restart
 
Final Step is to test installation of php and apache on server
 
Open web browser and type 
https://your ip address
 
It should open all the information about php extensions etc
 
Note:- 
 If after successful installation of apache,it does not listen to web request simply type following commands
 # iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# /etc/init.d/iptables save