If Not True Then False

Install Apache/PHP 7.2.0 on Fedora 27/26, CentOS/RHEL 7.4/6.9 - Comment Page: 7

This guide shows howto install Apache HTTP Server (httpd) with PHP 7.2.0 and following modules on Fedora 27/26/25, CentOS 7.4/6.9 and Red Hat (RHEL) 7.4/6.9 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...


Leave a Comment

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

Input your comment.

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

Input your name.


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 Reply

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 Reply
Jan Theofel

Thanks for the documentation!

Unluckily the php-gd package won’t install:
Error: Package: php-gd-5.5.15-1.el6.remi.x86_64 (remi-php55)
Requires: libgd.so.3()(64bit)

But the library seems to be there:
yum --enablerepo=remi install gd-devel
results in:
Package gd-devel-2.0.35-11.el6.x86_64 already installed and latest version

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

reply 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 Reply

[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 Reply


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 Reply

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

reply Reply

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

reply Reply

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

reply Reply
C. Masagi

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…

reply Reply

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:

firewall-cmd --get-active-zones

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

firewall-cmd --permanent --zone=FedoraWorkstation --add-service=http

Then restart firewalld using following command:

systemctl restart firewalld.service

And try again.

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

reply Reply
C. Masagi

Thank you JR…
Now everything runs smoothly…

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

Thanks! Problem Solved! :-)

reply Reply
white hat

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.

reply Reply

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.

reply Reply

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

reply Reply

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.

reply Reply

I have elel-release and remi loaded.
I just want to download and enable apcu and memcached. I have tried

yum –enablerepo=remi,remi-php56 install php-pecl-apcu php-pecl-memcache php-pecl-memcached

but still get no pakage php-pecl-apcu available

reply Reply

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:

reply Reply
John Brines

Hi Bud,

I have already done all this prior to fining your blog but I just cannot get php to run on my Apache it just list the text of the php file as well as if I go to the main page it just lists my virtual pages!!!!!

reply Reply

Hi John,

Did you tested simple /var/www/html/test.php -> http://localhost/test.php without any other configurations?

Could you post little bit more info about your installed packages:

rpm -qa httpd php\* |sort -V

And following configs:

reply Reply