Install Apache/PHP 5.6.13 on Fedora 22/21, CentOS/RHEL 7.1/6.7/5.11

This guide shows howto install Apache HTTP Server (httpd) with PHP 5.6.13 and following modules on Fedora 22/21/20/19, CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/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

1. Install Apache HTTP Server (httpd) and PHP 5.6.13 on Fedora 22/21/20/19, CentOS / Red Hat (RHEL) 7.1/6.7/5.11

1.1 Change root user

1.2 Install Remi repository


CentOS and Red Hat (RHEL)

1.3 Install Apache (httpd) Web server and PHP 5.6.13

Fedora 22

Fedora 21

Fedora 20/19

CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/5.11

1.4 Install PHP 5.6.13 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 22

Fedora 21

Fedora 20/19

CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/5.11

1.5 Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot

1.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.

1.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

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

2.1 CentOS/Red Hat (RHEL) 6.7/5.11

2.1.1 Edit /etc/sysconfig/iptables file:

2.1.2 Add following INPUT rule:

2.1.3 Restart Iptables Firewall:

2.2 Fedora 22/21/20/19 and CentOS/Red Hat (RHEL) 7.1

2.2.1 List Your Active Firewalld Zones

Example output:

2.2.2 Add New Rule to Firewalld

You might have active zone like public, FedoraWorkstation, FedoraServer.

2.2.3 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 22/21/20/19, CentOS 7.1/6.7/5.11, Red Hat (RHEL) 7.1/6.7/5.11 >>

Share this post


  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!).


  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..

  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.)

    • Hi Jan,

      You are welcome! And sorry for the late reply.

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

  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!!!

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


    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.

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

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

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

  10. Hi JR…

    I follow your Tutorials for HTTPD on Fedora 21….. everything is OK…
    I tested on local installation say server.. using elinks…. Service HTTPD runs Okay…

    But when I tested on other computer say Windows 7 with Firefox 35…. the don’t appear…. Firefox said “The server at is taking too long to respond.”

    I wonder why… I follow firewall rules as this tutorial described… but still can not connect to web server via network….

    Is it something I miss or else?

    Thank You very much…

    • Hi C. Masagi,

      Actually Fedora 21 is changed a little bit firewalld configuration. It’s possible that you have not public zone enabled anymore example on workstation installation.

      You can list your active zones using following command:

      If you have FedoraWorkstation active for your ‘public’ network interface, then run following command:

      Then restart firewalld using following command:

      And try again.

      I will update this guide too to be better compatible with Fedora 21.

      • Thank you JR…
        Now everything runs smoothly…

        I use Fedora 21 Server, so I choose –zone=FedoraServer … and add the service…

        Thanks! Problem Solved! :-)

        • Excellent! You’re welcome! :)

  11. Hello, I want to congratulate him for his work.
    I found it very good.
    And I wonder if you have any tutorial on how to read the rules configured in the pre iptable? I ask because I want to share the internet with centOS 7, and I fear to remove any rules that I should not move.
    I want to share the internet with LAN users who have a proxy, one domain running on BIND, Apache server and A, and the Zimbra email.
    If you can give me the help I am grateful.

  12. Thanks for this guide! Just a question: if the system already contains old installations of PHP, MySQL or whatever, should they be removed first? Or do they get updated? You could add this information to your guide.

    • Hi Robert,

      They get updated. “yum install” command updates your packages if some are already installed and update is available.

      Always good practice is keep backups and use test server(s) to test everything before updating production server(s).

      • Thanks!

  13. I have centOS 6 and just want to install APCu. I have tried
    yum –enablerepo=remi,remi-php56 install php-pecl-apcu
    And get No package php-perl-apcu available.
    I then tried wget /tar cmd and have a apcu-4.0.7 folder but not sure how then to proceed.

  14. I can’t install remi I get warning: /var/tmp/rpm-tmp.YFAEEn: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
    error: Failed dependencies:



  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. & [...]

Submit a Comment

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