Open Source Technical Information: How to Install Apache/PHP 5.3.8 on Fedora 16/15, CentOS/Red Hat (RHEL) 6/5.7

Tuesday, 22 November 2011

How to Install Apache/PHP 5.3.8 on Fedora 16/15, CentOS/Red Hat (RHEL) 6/5.7

,


This guide shows howto install Apache HTTP Server (httpd) with PHP 5.3.8 and following modules:
  • PEAR
  • PDO
  • MySQL
  • PostgreSQL
  • Memcache
  • GD
  • XML
  • MBString
  • MCrypt
on Fedora 16/15/14/13/12/11/10/9/8, CentOS 6/5.7 and Red Hat (RHEL) 6.1/6/5.7 systems.

Install Apache HTTP Server (httpd) and PHP 5.3.8


1. Change root user

su -
## OR ##
sudo -i


2. Install Remi repository

Fedora

Currently not mandatory on Fedora 16 and Fedora 15
## Remi Dependency on Fedora
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
 
## Fedora 16 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm
 
## Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm
 
## Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm
 
## Fedora 13 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm
 
## Fedora 12 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm
 
## Fedora 11 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-11.rpm
 
## Fedora 10 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-10.rpm
 
## Fedora 9 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-9.rpm
 
## Fedora 8 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-8.rpm



CentOS and Red Hat (RHEL)

## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
 
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 
 
## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
## CentOS 5 and Red Hat (RHEL) 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm



3. Install Apache (httpd) Web server and PHP 5.3.8


Fedora 16 and Fedora 15

yum install httpd php php-common


Fedora 14/13/12/11/10/9/8, CentOS 6/5.7 and Red Hat (RHEL) 6.1/6/5.7

yum --enablerepo=remi install httpd php php-common



4. Install PHP 5.3.8 modules

Select what you need: PEAR, PDO, MySQL, PostgreSQL, Memcache, GD, MBString, MCrypt, XML


Fedora 16 and Fedora 15

yum install php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml


Fedora 14/13/12/11/10/9/8, CentOS 6/5.7 and Red Hat (RHEL) 6.1/6/5.7

yum --enablerepo=remi install php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml


5. Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot

/etc/init.d/httpd start ## use restart after update
## OR ##
service httpd start ## use restart after update
 
chkconfig --levels 235 httpd on


6. Create test PHP page to check that Apache, PHP and PHP modules are working

Add following content to /var/www/html/test.php file.

 
    phpinfo();
 
?>


7. Check created page with browser

Access following address, with your browser. http://localhost/test.php


Enable Remote Connection to Apache HTTP Server (httpd) –> Open Web server Port (80) on Iptables Firewall (as root user again)


1. Edit /etc/sysconfig/iptables file:

nano -w /etc/sysconfig/iptables


2. Add following line before COMMIT:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


3. Restart Iptables Firewall:

service iptables restart
## OR ##
/etc/init.d/iptables restart



Enjoy ....Must like and Comment .



0 comments to “How to Install Apache/PHP 5.3.8 on Fedora 16/15, CentOS/Red Hat (RHEL) 6/5.7”

Post a Comment

Write your tips here...

Deal of the Day

Advertisement here

Advertisement here