{"id":1156,"date":"2018-08-27T02:42:53","date_gmt":"2018-08-26T21:12:53","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1156"},"modified":"2019-04-27T07:42:41","modified_gmt":"2019-04-27T02:12:41","slug":"how-to-install-php-7-in-centos-7","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-install-php-7-in-centos-7\/","title":{"rendered":"How to Install PHP 7 in CentOS 7"},"content":{"rendered":"<p><strong>Description<\/strong><\/p>\n<p>The CentOS 7 official software repositories have PHP 5.4 which has reached the end of life and no longer actively maintained by the developers.<\/p>\n<p>To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system.<\/p>\n<p>For the purpose of this guide, we will be operating the system as root, if that is not the case for you, make use of the sudo command to acquire root privileges.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Installing PHP 7 on CentOS 7<\/strong><\/p>\n<p>1. To install PHP 7, you have to install and enable EPEL and Remi repository to your CentOS 7 system with the commands below.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm\n# yum install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm<\/pre>\n<p>&nbsp;<\/p>\n<p>2. Next, you need to install yum-utils, a collection of useful programs for managing yum repositories and packages. It has tools that basically extend yum\u2019s default features.<\/p>\n<p>It can be used for managing (enabling or disabling) yum repositories as well as packages without any manual configuration and so much more.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum install yum-utils<\/pre>\n<p>&nbsp;<\/p>\n<p>3. One of the programs provided by yum-utils is yum-config-manager, which you can use to enable Remi repository as the default repository for installing different PHP versions as shown.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum-config-manager --enable remi-php70 [Install PHP 7.0]<\/pre>\n<p>If you want to install PHP 7.1 or PHP 7.2 on CentOS 7, just enable it as shown.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum-config-manager --enable remi-php71 [Install PHP 7.1]\n# yum-config-manager --enable remi-php72 [Install PHP 7.2]<\/pre>\n<p>&nbsp;<\/p>\n<p>4. Now install PHP 7 with all necessary modules with the command below.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo<\/pre>\n<p>Afterwards, double check the installed version of PHP on your system.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># php -v<\/pre>\n<p>&nbsp;<\/p>\n<p>We hope you\u2019ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description The CentOS 7 official software repositories have PHP 5.4 which has reached the end of life and no longer actively maintained by the developers. To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system. For the purpose of this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1286,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1156","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1156"}],"version-history":[{"count":1,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1156\/revisions"}],"predecessor-version":[{"id":1158,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1156\/revisions\/1158"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1286"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}