Install php later in Centos

Source: Internet
Author: User

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.

Introduction

PHP (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 Source

Install 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 now

Install 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 webpage

For 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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.