PHP
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php74
yum -y install php php-{cli,curl,mysqlnd,devel,gd,pear,mcrypt,mbstring,xml,pear}
yum -y install epel-release
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php72
yum -y install php php-{cli,curl,mysqlnd,devel,gd,pear,mcrypt,mbstring,xml,pear}
## Install PHP 7.4
yum --enablerepo=remi-php74 install php
## Install PHP 7.3
yum --enablerepo=remi-php73 install php
## Install PHP 7.2
yum --enablerepo=remi-php72 install php
## Install PHP 7.1
yum --enablerepo=remi-php71 install php
----------
Upload file size in webmail:
# vi /etc/php.ini
memory_limit = 512M; upload_max_filesize = 50M; post_max_size = 80M;
date.timezone = Asia/Dhaka
Remove
yum remove php*
yum remove php *
yum remove php-common
rpm -e --nodeps php-common
yum -y remove php-common-5.4*
systemctl restart httpd.service
PHP 7.3, PHP 7.3-FPM on RHEL 8 / CentOS 8
dnf -y update dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm yum -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpmdnf module list | grep phpdnf -y install dnf-plugins-corednf config-manager --set-enabled remi-php73dnf config-manager --set-enabled remidnf module install php:remi-7.3dnf update# php -vsystemctl enable --now php-fpmdnf module install -y httpdsystemctl enable --now php-fpm httpddnf install epel-release
dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm
To install dnf utilities.
dnf install dnf-utils -yTo enable php 8.2 Remi repository.
dnf module reset phpand
dnf module install php:remi-8.2 -y
[root@] # dnf module install php:remi-8.2 # dnf update # dnf install php # php -v
dnf -y install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-pear php-ldap
dnf install php-ldap php-imagick php-common php-gd php-imap php-json php-curl php-zip php-xml php-mbstring php-bz2 php-intl php-gmp -y
dnf install php-mysql php-xml pcre php-common php-mbstring php-pear curl unzip -y
dnf -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel
Remi, a third-party repository which offers multiple versions of PHP 7.X,
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
Install the Remi repository by using the below command,
yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
List Available PHP module streams Check the available PHP modules by using following command,
yum module list php
Enable PHP:remi-7.4 module to install PHP 7.4
yum module enable php:remi-7.4 -y
yum install -y php php-cli php-common
php -v
-------------------X-------------------------
PHP 7.4, 7.3 & 7.2 on CentOS/RHEL 7
yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Install PHP 7 on CentOS
# php -v
PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Install PHP Modules
### For PHP 7.4
yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-pear php-ldap
### For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-pear php-ldap
### For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-pear php-ldap
### For PHP 7.1
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-pear php-ldap
yum --enablerepo=remi-php71 install php-ldap php-imagick php-common php-gd php-imap php-json php-curl php-zip php-xml php-mbstring php-bz2 php-intl php-gmp -y ->Roundcube
yum --enablerepo=remi-php71 install php-mysql php-xml pcre php-common php-mbstring php-pear php-json curl unzip -y ->Rainloop
yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-json php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel ->Rainloop
CentOS / RHEL 7.1 & 6.7 -Install PHP 7.0, Apache 2.4, & MySQL 5.6
php-json php-xml
PHP version 7.1 is not available in the default CentOS 7 repositories so we will use the Remi repository.
To install and enable both EPEL and Remi repositories run the following command:
yum install epel-release rpm -Uhv https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php71
You can now proceed and install PHP 7.1 and all necessary PHP modules using the following command:
yum install php php-common php-mbstring php-gd php-curl php-mysql php-xml
1. Setup Yum Repository
In the first step install all the required yum repositories in your system used in remaining tutorial for various installations. You are adding REMI, EPEL, Webtatic & MySQL community server repositories in your system.
CentOS / RHEL 7
yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm ## rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm [ not needed to install MySQL ]
CentOS / RHEL 6
yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm ## rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm [ not needed to install MySQL ]
2. Install PHP 7
Now install php 7 packages from webtatic rpm repository using following command.
# yum -y install php71w
Now install required php modules. Use following command to list available modules in yum repositories.
# yum search php70w
Now check all listed modules in above command and install required modules like below.
# yum -y install php71w-mysql php71w-xml php71w-soap php71w-xmlrpc # yum -y install php71w-mbstring php71w-json php71w-gd php71w-mcrypt
After installing php and other php modules restart Apache service.
# systemctl restart httpd.service
3. Install Apache 2.4
Apache (HTTPD) is the most popular web server used on Linux systems. Let’s install Apache web server using following command with enabling epel and remi yum repositories.
# yum --enablerepo=epel,remi install httpd
Now start httpd service and enable to start on boot using below commands.
systemctl start httpd.service systemctl enable httpd.service
4. Install MySQL 5.6
In step 1 we already have installed required yum repository in your system. Lets use following command to install MySQL server on your system.
# yum install mysql-server
Apply security on mysql and also set root user password.
# systemctl start mysqld.service # mysql_secure_installation
Now restart MySQL service and enable to start on system boot.
# systemctl restart mysqld.service # systemctl enable mysqld.service
5. Open Port in Firewall
Finally open firewall ports for http (80) and https (443) services using following command.
# firewall-cmd --permanent --zone=public --add-service=http # firewall-cmd --permanent --zone=public --add-service=https # firewall-cmd --reload
6. Check Installed Version
Let’s check the installed versions of packages on system using following commands one by one.
# php -v PHP 7.0.0 (cli) (built: Dec 2 2015 20:42:32) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
# httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Nov 19 2015 21:43:13
# mysql -V mysql Ver 14.14 Distrib 5.6.28, for Linux (x86_64) using EditLine wrapper
Now you have successfully configured LAMP setup on your CentOS / RHEL 7.1 & 6.7 system.
CentOS 7.3/6.9 and Red Hat (RHEL) 7.3/6.9
yum --enablerepo=remi,remi-php71 install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y
yum -y install php71w php71w-snmp php71w-cli php71w-ldap php71w-xml php71w-session php71w-sockets php71w-pcre php71w-gd php71w-dom php71w-posix php71w-mbstring libc-client php71w-imap php71w-intl php71w-mysql php71w-common php71w-soap php71w-xmlrpc php71w-json php71w-gd php71w-mcrypt php71w-pear php71w-pear-DB php71w-opcache php71w-process php71w-pecl-mysql php71w-pear-DB php-pear-MDB2-Driver-mysql php71w-fedora-autoloader
# yum install yum-plugin-replace
# yum replace php-common --replace-with=php71w-common
php70w
php72w-common
yum -y install php php-mysql php-xml pcre php-common curl unzip
###################################################################################
Install PHP 7.1 on CentOS, RHEL or Fedora
Repositories configuration:
On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise Linux (EPEL) repository must be configured, and on RHEL the optional channel must be enabled.
Fedora 25
wget http://rpms.remirepo.net/fedora/remi-release-25.rpm dnf install remi-release-25.rpm
Fedora 24
wget http://rpms.remirepo.net/fedora/remi-release-24.rpm dnf install remi-release-24.rpm
RHEL version 7.2 or 7.3
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms
RHEL version 6.8
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6
CentOS version 7.2 (or 7.3)
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
CentOS version 6.8
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
remi-php71 repository activation
Needed packages are in the remi-safe (enabled by default) and remi-php71 repositories, the latest is not enabled by default (administrator choice according to the desired PHP version).
RHEL or CentOS
yum install yum-utils yum-config-manager --enable remi-php71
Fedora
dnf install dnf-plugins-core dnf config-manager --set-enabled remi-php71
PHP upgrade
By choice, the packages have the same name than in the distribution, so a simple update is enough:
yum update
That's all :)
$ php -v PHP 7.1.0 (cli) (built: Dec 1 2016 06:23:20) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
wget -q -O - http://www.atomicorp.com/installers/atomic | sh yum upgrade php yum -y remove atomic-release*
Error: php70w-common conflicts with php-common-5.4.1
Install php56w-common rpm package:
# yum --enablerepo=webtatic install php56w-common
http://repo.webtatic.com/yum/el7/x86_64/RPMS/php56w-common-5.6.40-1.w7.x86_64.rpm
Upgrade PHP version 5.4 to 5.6 on CentOS/RHEL 6/7
For CentOS/RHEL 7:
# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
For CentOS/RHEL 6:
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
After installing Webtatic yum repository, you have to remove the old version of php-common package. It will also delete it dependencies packages.
rpm -e --nodeps php-common
yum remove php-common
Now we install PHP 5.5 using following command:
# yum install -y php56w php56w-pear php56w-common php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-imap php56w-snmp php56w-cli php56w-ldap php56w-session php56w-sockets php56w-pcre php56w-dom php56w-posix libc-client
After installing PHP 5.6, we need to restart Apache service.
# /etc/init.d/httpd restart
# php -v
Install PHP 7.2 on CentOS 7 & CentOS 6
yum install -y --enablerepo=remi-php72 php php-cli
rpm -Uvh http://mirror.innosol.asia/remi/enterprise/remi-release-7.rpm yum install php70 yum install php70-php-mysqlnd php70-php-devel php70-php-gd php70-php-mcrypt php70-php-mbstring php70-php-pear php70-php-pecl-imagick php70-php-pecl-zip
-----------