Install php later in Centos
The built-in php version of Centos is very low. If we need to use a later version of php, we do not need to compile and install it. Directly Using yum for installation will save a lot of time and effort.
IntroductionPHP (Hypertext Preprocessor) is a common open source scripting language. The syntax absorbs the features of C, Java, and Perl, which is easy to learn and widely used and mainly applies to the Web development field. PHP's unique syntax is a mix of C, Java, Perl, and PHP's own syntax.
Compared with other programming languages, PHP embeds programs into HTML (an application under the standard General Markup Language) documents for execution, the execution efficiency is much higher than the CGI that completely generates the HTML Tag. PHP can also execute the compiled code to encrypt and optimize code execution, so that the code runs faster.
Install1. Check whether php is currently installed. rpm -qa|grep php
If you have installed PHP, delete these installation packages first:
yum remove php*
2. Install the php SourceInstall the php source in Centos 5:
rpm -ivh http://mirror.webtatic.com/yum/el5/latest.rpm
Install the php source in CentOs 6:
rpm -ivh http://mirror.webtatic.com/yum/el6/latest.rpm
Install the php source and epel extension source in CentOs 7:
rpm -ivh https://mirror.webtatic.com/yum/el7/epel-release.rpmrpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3. install php nowInstall the Basic installation package of php5.5:
yum install php55w php55w-gd php55w-mbstring php55w-mysql php55w-fpm
Install the Basic installation package of php5.6:
yum install php56w php55w-gd php56w-mbstring php56w-mysql php56w-fpm
Install the Basic installation package of php7.0:
yum install php70w php70w-gd php70w-mbstring php70w-mysql php70w-fpm
After installing php, restart apache:
service httpd restart
4. Test the webpageFor the php7.0 I installed, use php7.0 to write a webpage and test it.
vim /var/www/html/index.php<?php phpinfo(); ?>
Address: http://www.linuxprobe.com/centos-yum-php/