Linux环境安装PHP

Linux环境安装PHP

最近在CentOS上部署服务时,需要预安装PHP,找了一些文档都不好用,只有这篇成功了。https://computingforgeeks.com/how-to-install-php-7-3-on-centos-7-fedora/

原文

Hello good people!. Welcome to our guide on how to Install PHP 7.3 on CentOS 7 / Fedora. PHP is a popular server-side scripting language originally created by Rasmus Lerdorf in 1994. PHP is widely used for creating interactive and dynamic web pages. PHP competitors include Microsoft’s ASP.

For Ubuntu use How to install PHP 7.3 on Ubuntu 18.04 / Ubuntu 16.04 /

For Debian: How to Install PHP 7.3 on Debian 9 / Debian 8

Fedora 29 / Fedora 28: How to Install PHP 7.3 on Fedora 29 / Fedora 28

How to Install PHP 7.3 on CentOS 7 / Fedora
PHP 7.3 release got many bug fixes which include memory segmentation/corruption faults, undefined symbols, and other bug fixes. You can get a detailed report from PHP releases news.
.

Step 1: Add PHP 7.3 Remi repository

PHP 7.3 is available for CentOS 7 and Fedora distributions from the Remi repository. Add it to your system by running

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 
sudo yum -y install epel-release yum-utils

Step 2: Disable repo for PHP 5.4

By default, the enabled repository is for PHP 5.4. Disable this repo and enable on for PHP 7.3

sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php73

Step 3: How to Install PHP 7.3 on CentOS 7 / Fedora

Once the repo has been enabled, install php 7.3 on CentOS 7 or Fedora using the command

sudo yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

Check version installed

$ php -v

PHP 7.3.1 (cli) (built: Jan 8 2019 13:55:51) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright © 1998-2018 Zend Technologies
I will update this guide once the final release of PHP 7.3 is available for production use.

Step 4: Installing other PHP 7.3 Extensions

Install PHP 7.3 extensions by using the syntax

sudo yum install php-<entension-name>

As an example, to install a mysql module for PHP applications that use MySQL databases, you’ll run:

sudo yum install php-mysql

This will only work if the default repository for PHP packages is 7.3

sudo yum install php-mysqlnd
Confirm:

#rpm -qi php-mysqlnd
 Name        : php-mysqlnd
 Version     : 7.3.1
 Release     : 1.el7.remi
 Architecture: x86_64
 Install Date: Thu 10 Jan 2019 06:56:47 PM UTC
 Group       : Development/Languages
 Size        : 856852
 License     : PHP
 Signature   : DSA/SHA1, Tue 08 Jan 2019 06:44:21 PM UTC, Key ID 004e6f4700f97f56
 Source RPM  : php-7.3.1-1.el7.remi.src.rpm
 Build Date  : Tue 08 Jan 2019 06:24:34 PM UTC
 Build Host  : builder.remirepo.net
 Relocations : (not relocatable)
 Packager    : https://blog.remirepo.net/
 Vendor      : Remi Collet
 URL         : http://www.php.net/
 Bug URL     : https://forum.remirepo.net/
 Summary     : A module for PHP applications that use MySQL databases
 Description :
 The php-mysqlnd package contains a dynamic shared object that will add
 MySQL database support to PHP. MySQL is an object-relational database
 management system. PHP is an HTML-embeddable scripting language. If
 you need MySQL support for PHP applications, you will need to install
 this package and the php package.
 This package use the MySQL Native Driver

Enjoy using PHP 7.3 and feel free to report any bugs you encounter to the development team.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值