Hướng dẫn cài php 5.6 và các phiên bản php trên CentOS 6, CentOS 7 đơn giản

A

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Hôm nay mình xin hướng dẫn các bạn cách cài php các phiên bản trên CentOS 6 và CentOS 7
Để làm được thì bạn làm theo mình nhé

Đầu tiên bạn chạy lệnh sau
Code:
sudo yum install epel-release

Với CentOS 6 bạn chạy lệnh sau

Code:
https://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm

Với CentOS 7 bạn chạy lệnh sau

Code:
https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm

Sau đó bạn chạy tiếp lệnh này để sửa remi.repo
Code:
vi /etc/yum.repos.d/remi.repo

Nếu bạn muốn cài bản php nào thì enabled=0 bạn thay thành enabled=1 ở đó
Ví dụ mình muốn cài php 5.6 mình sẽ sửa như sau
Code:
[remi-php56]name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/6/php56/httpsmirror
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
[COLOR=#ff0000]enabled=1[/COLOR]
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

39156902121_dbf5f75835_o.png


Sau đó bạn lưu lại và chạy lệnh sau

Code:
yum install php-fpm php-cli php-mysqlnd php-gd php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-soap

Sau đó bạn khởi động lại Apache hoặc Nginx là xong
Mọi thắc mắc vui lòng phản hồi bên dưới hoặc gửi thông tin VPS mình sẽ đăng nhập hỗ trợ bạn
Chúc các bạn thành công!
Nguồn tuoitreit.vn
 

Facebook Comments

Similar threads

A
Replies
0
Views
1K
AdminAdmin is verified member.
A
A
Replies
0
Views
2K
AdminAdmin is verified member.
A
A
Replies
0
Views
2M
AdminAdmin is verified member.
A
A
Replies
0
Views
3K
AdminAdmin is verified member.
A
A
Replies
14
Views
23K
hantanviet
H
A
Replies
0
Views
3M
AdminAdmin is verified member.
A
A
Replies
1
Views
3M
mr.congdd
M
A
Replies
0
Views
3M
AdminAdmin is verified member.
A
Back
Top