CloudInsidr

Cyber security, infotech

  • Subscribe!
  • Privacy Policy
  • Legal
  • Contact Us

Join us on Twitter: @CloudInsidr

Follow us on Twitter: @cloudinsidr
  • news & alerts
    • events
    • industry analysis
    • industry gossip
    • people
  • cloud, edge & co.
    • AWS
    • administration & orchestration
      • web servers in the cloud
      • mail servers
      • databases
  • cybersec & warfare
    • encryption
  • blockchain
Home cloud, edge and everything in between administration and orchestration web servers in the cloud php-fpm How to Install PHP 7 on Fedora, RHEL, CentOS 7 — the Red Hat family
How to Install PHP 7 on Fedora, RHEL, CentOS 7 — the Red Hat family

Filipe Martins 2015-12-09 Leave a Comment

How to Install PHP 7 on Fedora, RHEL, CentOS 7 — the Red Hat family

Installing PHP on the Red Hat family—Fedora, RHEL, CentOS 7—is a must for cyber security and it’s not rocket science. With a few easy steps, you too can bring your PHP based web applications to the next level.

PHP 7 brings such profound improvements that the lucky 7 as a version number seems more than justified. The upgrade is easy, painless, and takes just a couple of quick steps. Here is how to do it.

[tweet “#PHP 7.0.1 released, RPMs already available in #remirepo 4 #fedora #rhel & #centos via @cloudinsidr thnx @RemiCollet”]

RedHat has completed the transition of RHEL/Fedora from yum to its next iteration, DNF (dnf), short for dandified yum. It supports RPM, libsolv, and hawkey libraries. DNF (which inherited some qualities from both yum and aptitude) has been released for Fedora with user and admin guides. Use it the way you would work with yum.

To get your hands on a working installation of PHP 7, you can currently use either the old yum or dnf (here is the command reference).

In Remi’s RPM repository, PHP RPMs have been renamed php70 in order to allow installation alongside the default PHP of your CentOS/RHEL/Fedora (if there is one on your system). The FPM service (php70-php-fpm) listens on the default port 9000 so it may need adjusting should another version of PHP be already running.

Follow these steps to install PHP 7 on CentOS with php-fpm, the server API or SAPI of choice for NGINX, using the Remi repository, on x86_64. You must be root (sudo su , otherwise prepend the relevant commands with sudo to execute them as root).

Step 1. Get yourself the REMI repo

Install the Remi repository (#remirepo for #fedora, #rhel and #centos) with these commands (you must be root, see the paragraph above):

wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm 
sudo rpm -Uvh remi-release-7*.rpm

 Step 2. Install PHP 7

Install PHP 7 from the remi repository:

yum --enablerepo=remi-php70 install php70-php

Step 3. Install PHP extensions

Install PHP modules using the remi repository (the example is a recommended configuration):

yum --enablerepo=remi-php70 install php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring php70-php-mcrypt

To find out which other extensions are available, use search with yum:

yum search php70

Speaking of extensions: ereg, mssql, sybase_ct and mysql have been removed from PHP.

In order to enable the remi repository only during software installation (that is: only when you need it), use the –enablerepo=remi  option with yum. For example like this:

sudo yum --enablerepo=remi install php-tcpdf

To update your already installed packages using the Remi repository, you would enter this command:

yum --enablerepo=remi update remi-release

Step 4. Start PHP

To start PHP (once) use this command:

service php70-php-fpm start

or

systemctl start php70-php-fpm

Step 5. Enable automatic launch of PHP 7 on system startup

Enable automatic launch of the PHP interpreter on system startup on CentOS 7/Red Hat/Fedora, use this command:

systemctl enable php70-php-fpm

The output of this command should resemble this line:

ln -s '/usr/lib/systemd/system/php70-php-fpm.service' '/etc/systemd/system/multi-user.target.wants/php70-php-fpm.service'

You can verify the current status of PHP 7 using this command:

systemctl status php70-php-fpm

[root@ip-16-0-0-170 centos]# systemctl status php70-php-fpm
php70-php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php70-php-fpm.service; enabled)
Active: active (running) since Thu 2015-12-10 05:29:25 UTC; 2s ago
Main PID: 2102 (php-fpm)
Status: "Ready to handle connections"
CGroup: /system.slice/php70-php-fpm.service
├─2102 php-fpm: master process (/etc/opt/remi/php70/php-fpm.conf)
├─2103 php-fpm: pool www
├─2104 php-fpm: pool www
├─2105 php-fpm: pool www
├─2106 php-fpm: pool www
└─2107 php-fpm: pool www

Dec 10 05:29:25 ip-12-3-4-170.ec2.internal systemd[1]: Started The PHP FastCGI Process Manager.

This output also shows you that php-fpm pools, while running, have not been configured yet.

If you also want to set up MySQL/MariaDB, you may want to read: High-Stakes, High-Security LEMP Setup: Nginx with MariaDB/MySQL, and PHP 7.x on CentOS 7 (RHEL/Fedora) with SELinux

Subscribe to our newsletter and we will keep you up to date.


[wysija_form id=”1″]

Related:

  • How to fix PHP sessions to ensure security 
  • How to check your current PHP configuration settings without exposing your server.

 

Remi's RPM repository

Here is what you can do now: why don’t you visit the Amazon wishlist of @RemiCollet and say Thank you: http://amzn.to/1MjuS2N for compiling PHP for you! The Donations page is here: http://rpms.remirepo.net/

Large Rectangle (336 x 280)

Filed Under: administration and orchestration, Linux, NGINX, php-fpm, SELinux, web servers in the cloud Tagged With: CentOS, dnf, Fedora, NGINX, PHP 7, php-fpm, Red Hat, remi repo, repo, RHEL, SAPI

Leave a Reply Cancel reply

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

Subscribe

SSL/TLS Certificate Square (250 x 250)

Pearson Education (InformIT)

SSL/TLS Certificate Medium Rectangle (300 x 250)

Recent Posts

  • Upgrading from CentOS 6 to CentOS 7 and Beyond?
  • How To Figure Out Who is Signing In To Dovecot to Send or Retrieve Email
  • OpenSSH 9.9 Introduces Enhanced Quantum-Resistant Algorithms
  • OpenSSL 3.3 Final Release is now live!
  • How to Activate HTTP/2 with TLS 1.3 Encryption in NGINX for Secure Connections without a Performance Penalty
  • Is AWS sucking your budget dry? Strip it down to the nitty-gritty (without breaking stuff)
  • How to attach and mount an NVMe EBS volume on EC2
  • SELinux security contexts: correcting SELinux labels on a file system
  • Intel gobbling up Israeli Tower Semiconductor, Stock Goes Through The Roof
  • NGINX on AWS EC2: setting up a web server from scratch on a domain of your choice
  • Log4j RCE and mitigation techniques
  • Set up logrotate for Postfix

Symantec

Categories

  • administration and orchestration
  • alerts
  • AWS
  • Bitcoin
  • cloud, edge and everything in between
  • cryptocurrencies
  • cybersecurity and cyber warfare
  • databases
  • DNS
  • encryption
  • events
  • FinTech and InsurTech
  • homeland security
  • HTTP Security Headers
  • industries
  • industry analysis
  • industry gossip
  • Java
  • Linux
  • mail servers
  • networking
  • news
  • NGINX
  • people
  • php-fpm
  • reviews
  • SELinux
  • tips and tricks
  • Uncategorized
  • web servers in the cloud

Tags

AMI AWS AWS EBS Azure certificate cipher suites cryptography cyber defense cybersecurity cyber security Diffie-Hellman DNS DNS over HTTPS Dovecot EBS EC2 email encryption Fedora HTTP/2 HTTPS IBM letsencrypt Linux logs MariaDB MFA MySQL NGINX OpenSSL permissions php-fpm PHP 7 postfix RegEx Route 53 RSA SELinux SQL SSH SSL TLS TLS 1.3 TLS vulnerabilities WordPress

Archives

  • January 2025
  • November 2024
  • October 2024
  • May 2024
  • January 2023
  • March 2022
  • February 2022
  • December 2021
  • December 2020
  • November 2020
  • September 2020
  • January 2020
  • November 2019
  • August 2019
  • July 2019
  • April 2019
  • December 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018
  • February 2018
  • December 2017
  • November 2017
  • October 2017
  • August 2017
  • April 2017
  • February 2017
  • January 2017
  • November 2016
  • September 2016
  • August 2016
  • July 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • July 2015
  • February 2015

Recent Comments

    Wicked fast Networking (With a Government Clearance to Boot)

    ©2022 CybrAnalytiqa OÜ

    • Content purchasing and syndication