Install Apache/PHP 5.6.4 on Fedora 21/20, CentOS/RHEL 7/6.5/5.11

This guide shows howto install Apache HTTP Server (httpd) with PHP 5.6.4 and following modules on Fedora 21/20/19, CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11 systems.

  • OPcache (php-opcache) – The Zend OPcache provides faster PHP execution through opcode caching and optimization.
  • APCu (php-pecl-apcu) – APCu userland caching
  • CLI (php-cli) – Command-line interface for PHP
  • PEAR (php-pear) – PHP Extension and Application Repository framework
  • PDO (php-pdo) – A database access abstraction module for PHP applications
  • MySQL (php-mysqlnd) – A module for PHP applications that use MySQL databases
  • PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP
  • MongoDB (php-pecl-mongo) – PHP MongoDB database driver
  • SQLite (php-pecl-sqlite) – Extension for the SQLite V2 Embeddable SQL Database Engine
  • Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon
  • Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon
  • GD (php-gd) – A module for PHP applications for using the gd graphics library
  • XML (php-xml) – A module for PHP applications which use XML
  • MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling
  • MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support

Install Apache HTTP Server (httpd) and PHP 5.6.4 on Fedora 21/20/19, CentOS / Red Hat (RHEL) 7/6.6/5.11

1. Change root user

2. Install Remi repository

Fedora

CentOS and Red Hat (RHEL)

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

Fedora 21

Fedora 20/19

CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11

4. Install PHP 5.6.4 modules

Select what you need: OPcache, APCu, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, SQLite, Memcache, Memcached, GD, MBString, MCrypt, XML

More info about PHP APC from PHP APC Configuration and Usage Tips and Tricks.

Fedora 21

Fedora 20/19

CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11

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

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.

7. Check created page with browser

Access following address, with your browser. http://localhost/test.php
CentOS 7 running Apache and PHP 5.6.0

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

1. CentOS/Red Hat (RHEL) 6.6/5.11

1.1 Edit /etc/sysconfig/iptables file:

1.2 Add following INPUT rule:

1.3 Restart Iptables Firewall:

2. Fedora 21/20/19 and CentOS/RHEL 7

2.1 Add New Rule to Firewalld

2.2 Restart firewalld.service

3. Test remote connection

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

More reading:

Enable Apache Userdir with SELinux on Fedora 21/20/19/18/17, CentOS 7/6.6/5.11, Red Hat (RHEL) 7/6.6/5.11 >>

Share this post

232 Comments

  1. I am Under Centos 6.5

    Thanks for all tutorials on this website.
    They are really good for me (and maybe for the others!).

    Reply

  2. yum install httpd httpd-devel mysql mysql-server mysql-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml -y; service mysqld start && mysql_secure_installation && service mysqld restart && service httpd start && chkconfig httpd on && chkconfig mysqld on &&iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT && /etc/init.d/iptables save

    A one liner.. Takes a couple mins and Bang..

    Reply
  3. Thanks for the documentation!

    Unluckily the php-gd package won’t install:

    But the library seems to be there:

    results in:

    (Note: I installed not all of the php packages as they are not needed on my system.)

    Reply
    • Hi Jan,

      You are welcome! And sorry for the late reply.

      gd-last package (which provides libgd.so.3) should be installed as php-gd-5.5.15 dependency. Did you already get php-gd installed?

      Reply
  4. [root@localhost etc]# service httpd start
    Redirecting to /bin/systemctl start httpd.service
    Job for httpd.service failed. See ‘systemctl status httpd.service’ and ‘journalctl -xn’ for details.

    thanx in advance those solved the error!!!

    Reply
  5. Please resolve my issue as quick as possible it’s too urgent!!!!!!!!!!

    Reply
  6. Hi HILESH KALAL,

    Did you get this solved? Looks like some sort of syntax error on your config files. Normally these cases is good to check error logs to see more information about real error or alternatively run httpd configtest after configuration file changes.

    Reply
  7. Hi, I have RHEL 6.0 in my Oracle virtual Box. can u pls route me to the 6.0 repository…

    Reply
  8. I am running into the same problem. Did anybody figure out how to solve this yet? Thank you.

    Reply
  9. Looks as though epel 7 for centos is out of beta. IS it now best to change rpm links?

    Reply

Trackbacks/Pingbacks

  1. Install Apache (httpd) and PHP 5.3.3 on Fedora 13, CentOS/RHEL 5.5/6 « apache - [...] PeÅ‚ny artykuÅ‚ na: Install Apache (httpd) and PHP 5.3.3 on Fedora 13, CentOS/RHEL 5.5/6 [...]
  2. Configuring PHP, Apache and Squirrelmail - [...] scripting language. Take a look at this. https://www.digitalocean.com/communi...ck-on-centos-6 http://www.if-not-true-then-false.co...-red-hat-rhel/ & [...]

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">