Skip to content

How to Do IT

Information Technology Explained

  • Hardware
  • Linux
  • Network
  • Office
  • Security
  • Windows
  • Reviews
How to Do IT
Information Technology Explained

Install PHP 7.2 under CentOS 7

CentOS is one of the top scorers among the free Linux operating systems with just over 20% market share among the open source operating systems. If you install Cent OS 7 today (in the year 2019) and would like to use PHP afterwards, you’ll encounter a bad surprise: The “latest” packaged version for CentOS 7 ist PHP 5.4

This version of PHP is already deprecated a long time ago and support for PHP 5.4 has ended by September 2015 ( Link: https://php.net/supported-versions.php )

So if you are an IT or linux administrator and want to deploy php on your newly installed Centos / server, you have to find a different way to install PHP . Otherwise you’d run the risk of getting hacked.

By the time of this writing the latest version of PHP being both up-to-date and maintained by the PHP developpers is PHP 7.2. So let’s jump in and install PHP 7.2. on CentOS 7:

First you should update the operating (CentOS) itself with:

yum –y update

 

This might take anywhere from a few seconds to several minutes. It mainly depends on how fast your server and internet connection are. And of course it depends on how long hou haven’t done any updates.

Please note: If there is any kernel-package among the updated packages you should reboot your Centos machine.

Before we go ahead we need to enable two package depots. Don’t worry if you have already done this. It will do no harm if repeated:

yum –y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Before we continue it’s safe to uninstall any php or php-related software.

yum -y remove php-common php56w-common
yum -y remove mod_php71w php71w-opcache php71w-common
yum -y remove mod_php70w php70w-opcache php70w-common
yum -y remove mod_php72w php72w-opcache php72w-common


 

Now you can install PHP version 7.2:

Yum –y install php72w php72w-common php

Just in case you’d like to install most of the related software packages like mysql-drivers or other php-7.2 packages, here’s the more extensive list::

yum -y install mod_php72w php72w php72w-opcache php72w-common php72w-mysql php72w-devel php72w-gd php72w-xml php72w-mbstring php72w-pdo php72w-odbc php72w-xml php72w-soap php72w-mssql  php72w-common php72w-mysql php72w-xmlrpc php72w-snmp php72w-process php72w-pear php72w-gd php72w-ldap php72w-cli php72w-mbstring php72w-opcache

 

Last but not least you might want to check the installed vesion of PHP. You can do this by typing “php –v” . Your output should look like this:

[root@fmtest02mb ~]# php -v
PHP 7.2.17 (cli) (built: May 13 2019 18:03:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.17, Copyright (c) 1999-2018, by Zend Technologies
[root@fmtest02mb ~]#

The important part ist “PHP 7.2.17 (cli)”.

Conclusion: If you know how – removing any old PHP package and installing PHP 7.2 is pretty easy. Now your users can enjoy the speed and robustness of PHP 7 under Centos 7.

 

 

  • About the Author
  • Latest Posts
Avatar of Matthias
Matthias

Matthias Böhmichen is the founder of howto-do.it . He is using Linux since 1991 and fell in love with windows a few years later. He likes to discover new technologies, especially hard- and software.

  • What is Rocky Linux Explained
  • Your Guide on How to SSH into Ubuntu - Simple Steps and Tips
  • Easy Guide: How to Install Packages in Ubuntu for Beginners

Recent Posts

  • Autonomous AI Agent Orchestration Linux 2026: Production Architecture & Automation
    Autonomous AI Agent Orchestration Linux 2026: Production Architecture & Automation
    01/10/2026
  • Linux Server Security Audit Guide 2026: Complete Hardening and Compliance Manual
    Linux Server Security Audit Guide 2026: Complete Hardening and Compliance Manual
    01/10/2026
  • Ubuntu Server 24.04 LTS Setup Guide 2026: Complete Beginner Tutorial
    Ubuntu Server 24.04 LTS Setup Guide 2026: Complete Beginner Tutorial
    29/09/2026
  • Linux Bash Scripting Automation 2026: Complete Tutorial for Beginners
    Linux Bash Scripting Automation 2026: Complete Tutorial for Beginners
    29/09/2026
  • Windows 11 2026 New Features and Tips Guide: Complete Overview
    Windows 11 2026 New Features and Tips Guide: Complete Overview
    29/09/2026
  • Linux Runtime Security with auditd & Falco: Detecting Anomalies in AI & Container Workloads (2026 Guide)
    Linux Runtime Security with auditd & Falco: Detecting Anomalies in AI & Container Workloads (2026 Guide)
    28/09/2026
  • Ubuntu 26.04 LTS New Features 2026: Complete Server and Desktop Guide
    Ubuntu 26.04 LTS New Features 2026: Complete Server and Desktop Guide
    28/09/2026
  • Nginx Reverse Proxy Setup with SSL: Complete Guide 2026
    Nginx Reverse Proxy Setup with SSL: Complete Guide 2026
    28/09/2026
  • LLM Prompting Techniques 2026: Chain of Thought and ReAct for AI Agents
    LLM Prompting Techniques 2026: Chain of Thought and ReAct for AI Agents
    28/09/2026

Search this Site

Search

Recent Posts

  • Docker Compose Multi-Container Setup Tutorial 2026: Complete Beginner Guide
    Docker Compose Multi-Container Setup Tutorial 2026: Complete Beginner Guide
    28/09/2026
  • Ubuntu 26.04 LTS Server Setup Guide 2026: Complete Installation & Configuration
    Ubuntu 26.04 LTS Server Setup Guide 2026: Complete Installation & Configuration
    28/09/2026
  • OpenClaw RL Tutorial 2026: Build Self-Learning AI Agents with Reinforcement Learning
    OpenClaw RL Tutorial 2026: Build Self-Learning AI Agents with Reinforcement Learning
    28/09/2026
  • Debian 12 Server Hardening: Complete Security Guide 2026
    Debian 12 Server Hardening: Complete Security Guide 2026
    28/09/2026
  • Ubuntu 26.04 LTS Server Security: Complete Hardening Guide 2026
    Ubuntu 26.04 LTS Server Security: Complete Hardening Guide 2026
    28/09/2026
  • Docker Container Deployment Tutorial: Complete Guide 2026
    Docker Container Deployment Tutorial: Complete Guide 2026
    28/09/2026
  • Bash Scripting Tutorial for Beginners: Automate Linux Tasks in 2026
    Bash Scripting Tutorial for Beginners: Automate Linux Tasks in 2026
    27/09/2026
  • How to Install and Configure OpenClaw AI Agents on Ubuntu 2026: Complete Tutorial
    How to Install and Configure OpenClaw AI Agents on Ubuntu 2026: Complete Tutorial
    27/09/2026
  • How to Harden Ubuntu 24.04 Server Security in 2026: Complete Guide
    How to Harden Ubuntu 24.04 Server Security in 2026: Complete Guide
    27/09/2026
  • Ubuntu Core 26 Livepatch Setup Guide: Rebootless Kernel Security Updates in 2026
    Ubuntu Core 26 Livepatch Setup Guide: Rebootless Kernel Security Updates in 2026
    27/09/2026
  • How to Secure Ubuntu Server 2026: Complete SSH Hardening and Firewall Setup Guide
    How to Secure Ubuntu Server 2026: Complete SSH Hardening and Firewall Setup Guide
    27/09/2026
  • How to Automate Linux Server Administration with Systemd Timers in 2026
    How to Automate Linux Server Administration with Systemd Timers in 2026
    27/09/2026
  • How to Build Shell Script Automation Workflows on Debian in 2026
    How to Build Shell Script Automation Workflows on Debian in 2026
    27/09/2026
  • How to Secure Your Linux Server: Shell Scripting Best Practices 2026
    How to Secure Your Linux Server: Shell Scripting Best Practices 2026
    27/09/2026
  • Ubuntu Server Security Hardening: Complete Guide 2026
    Ubuntu Server Security Hardening: Complete Guide 2026
    27/09/2026
  • How to Secure Ubuntu Server 2026: Complete Livepatch and Hardening Guide
    How to Secure Ubuntu Server 2026: Complete Livepatch and Hardening Guide
    26/09/2026
  • Linux Server Hardening Guide 2026: Complete Security Checklist
    Linux Server Hardening Guide 2026: Complete Security Checklist
    26/09/2026
  • How to Configure Security Headers in Nginx on Ubuntu 2026: Complete HSTS, CSP & Security Guide
    How to Configure Security Headers in Nginx on Ubuntu 2026: Complete HSTS, CSP & Security Guide
    26/09/2026
  • Bash Scripting Best Practices for Debian Servers in 2026
    Bash Scripting Best Practices for Debian Servers in 2026
    26/09/2026
  • How to Set Up a Secure Debian Server in 2026: Complete Step-by-Step Guide
    How to Set Up a Secure Debian Server in 2026: Complete Step-by-Step Guide
    26/09/2026
  • Linux SSH Security Hardening Guide 2026: Complete OpenSSH Firewall Configuration
    Linux SSH Security Hardening Guide 2026: Complete OpenSSH Firewall Configuration
    26/09/2026
Welcome to HowTo-Do.it, your destination to the world of information technology. Whether you're a tech novice or a seasoned enthusiast, our website is dedicated to empowering everyday users with the knowledge you need to confidently engage with software and hardware.
From demystifying complex software applications to unraveling the intricacies of hardware setups, we're here to guide you step-by-step.

Our Partners

  • Biteno GmbH
  • IT-ServiceCenter.com
  • Data Privacy
  • Imprint
  • Opt-out preferences
  • Howto-Do.IT in German
  • Sitemap

© 2026 How to Do IT

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}
Scroll to top
  • Hardware
  • Linux
  • Network
  • Office
  • Security
  • Windows
  • Reviews