Site operation and maintenance: centos7 installation php7

Copyright: Original, welcome to reprint https://blog.csdn.net/weixin_43731793/article/details/91488289

If the direct use yum install centos in: sudo yum -y install php, version 5.4, is not enough, so we have to manually update rpm can be.

1, first obtain rpm:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2, can then be used sudo yum list php*to see what version of php currently have, and can be found from 4-7.2 version has 7.2 version called 72w, so this version can be installed:

sudo yum -y install php72w

3, but after the installation is complete, enter php -v did not find the command, because php72w only minimal php libraries are installed, some applications are not yet installed, so you can install some expansion pack:

yum -y install php72w-cli php72w-common php72w-devel php72w-mysql
For wordpress applications, you may need to install the package follows:

sudo yum -y install php72w-gd php72w-imap php72w-ldap php72w-odbc php72w-pear php72w-xml php72w-xmlrpc

Php -v then enter the following message appears:
Here Insert Picture Description
installation.

4, so in order to make apache support php7.2, need to modify the apache configuration file:

First, find php configuration file: php.ini, use the find command:

sudo find / -name php.ini
In / etc, that is usually /etc/php.ini.

Then find the apache configuration file: httpd.conf

sudo find / -name httpd.conf
Locations are as follows:

/etc/httpd/conf/httpd.conf
Then modify the file, the file in the last line with:

PHPIniDir /etc/php.ini
Expressed tell apache, php configuration information file.

Guess you like

Origin blog.csdn.net/weixin_43731793/article/details/91488289