Hướng dẫn php 7.3 mysql extension

Bản phát hành PHP 7.3 có nhiều bản sửa lỗi, bao gồm lỗ memory segmentation/corruption faults

Bước 1: Add PHP 7.3 Remi repository

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

Bước 2: Disable repo PHP 5.4

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

Step 3: Install PHP 7.3 on CentOS 7

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 php vừa cài đặt

php -v
PHP 7.3.1 (cli) (built: Jan  8 2019 13:55:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies

Bước 4: Cài đặt các PHP 7.3 Extensions khác

Install PHP 7.3 extensions by using the syntax

sudo yum install php-

Ví dụ, cài đặt php mysql module

sudo yum install php-mysql

Nó chỉ hoạt động nếu repository PHP packages là 7.3

sudo yum install php-mysqlnd

Kiểm tra extension

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

Chúc các bạn thành công.

Trong kho phần mềm chính thức của CentOS 7 thì PHP 5.4 đã cũ và không còn được các nhà phát triển hỗ trợ, duy trì và cập nhật bản vá lỗi.

Để hỗ trợ cho những tính năng mới cũng như tăng cường khả năng bảo mật, bạn cần phiên bản PHP mới hơn trên hệ thống CentOS 7.

Hướng dẫn php 7.3 mysql extension

Hiện tại, PHP 7.3 là phiên bản được phát hành mới nhất của PHP. Trong nội dung bài viết này, chúng tôi sẽ hướng dẫn bạn cài đặt các phiên bản PHP 7.x (bao gồm 7.0, 7.1, 7.2 và 7.3) lên hệ thống CentOS & Redhat 7.

Cài đặt PHP 7 trên CentOS

Để cài đặt PHP 7, bạn cần cài đặt và kích hoạt EPEL và Remi repository trên hệ thống CentOS 7 bằng câu lệnh sau:

  • Cài đặt EPEL

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  • Cài đặt Remi

# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Server của bạn đã được thiết lập để cài đặt PHP từ yum repository. Sử dụng một trong những lệnh bên dưới để cài đặt PHP 7.0, PHP 7.1, PHP 7.2 hoặc PHP 7.3:

## 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

## Install PHP 7.0 
# yum --enablerepo=remi-php70 install php

Sau khi tiến trình cài đặt hoàn tất, để kiểm tra lại thông tin phiên bản PHP đang được kích hoạt lên server, bạn sử dụng lệnh:

# php -v

Cài đặt PHP Modules

Sau khi cài đặt một phiên bản PHP 7.x trên server, để cài đặt thêm một số PHP modules cần thiết cho các ứng dụng, bạn sử dụng lệnh bên dưới:

### For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.1
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt 

### For PHP 7.0
yum --enablerepo=remi-php70 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

Bạn có thể sử dụng lệnh bên dưới để tìm những PHP modules khác có sẵn trong yum repository đã được cấu hình:

# yum --enablerepo=remi-php73 search php | grep php73 [For PHP 7.3]

Chúc bạn thành công!

Gửi phản hồi về bài viết này