Hướng dẫn php version differences - sự khác biệt về phiên bản php

Từ phiên bản DirectAdmin 1.56.0 trở lên, Bạn có thể cài đặt nhiều phiên bản PHP  trên 1 Server DirectAdmin

Show

Trước tiên, hãy Snapshot lại VPS để đảm bảo có thể khôi phục lại ngay khi phát sinh lỗi

Bước 1: Cập nhật DirectAdmin trước khi nâng cấp phiên bản PHP

Nếu DA cài trên server của Bạn không có License thì có thể bỏ qua bước này.

Updating DirectAdmin Manually: chạy lệnh sau, trong đó 1234 là User ID, và 567890 là License ID của Bạn. Bạn có thể xem lại thông số này bằng cách đăng nhập và DA quyền admin, sau đó click vào “Licensing / Updates”
chạy lệnh sau, trong đó 1234 là User ID, và 567890 là License ID của Bạn. Bạn có thể xem lại thông số này bằng cách đăng nhập và DA quyền admin, sau đó click vào “Licensing / Updates”

cd /usr/local/directadmin
wget --no-check-certificate -O update.tar.gz 'https://www.directadmin.com/cgi-bin/daupdate?redirect=ok&uid=1234&lid=567890'
tar xvzf update.tar.gz
./directadmin p
cd scripts
./update.sh
service directadmin restart

Bước 2: Cài đặt nhiều phiên bản PHP

SSH vào Server với Quyền root

Sau đó chạy dòng lệnh này

Áp dụng cho cài đặt 4 phiên bản 5.6, 7.0, 7.1 và 7.3

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs

Việc cài đặt này sẽ diễn ra khoảng 10′ đến vài giờ, phụ thuộc vào tốc độ mạng của Bạn

Cần giữ màn hình SSH cho đến khi hoàn tất

Bước 3: Tùy chọn từng phiên bản PHP cho tên miền trên DirectAdmin

Bạn cần đăng nhập vào tài khoản admin trên web

Sau đó click “Show All Users” => chọn user có tên miền cần chỉnh => Login as user đóShow All Users” => chọn user có tên miền cần chỉnh => Login as user đó

Sau đó click luôn vào nút “Domain Administration” (nhiều domain trên host) hoặc click vào “Domain Setup” nếu chỉ có 1 domain trên hosting.

=> Sau đó click vào tên miền cần thay đổi phiên bản PHP

=> tại phần “PHP Version Selector” hãy chọn phiên bản phù hợp rồi nhấn nút SavePHP Version Selector” hãy chọn phiên bản phù hợp rồi nhấn nút Save

Hướng dẫn php version differences - sự khác biệt về phiên bản php

Như vậy là Bạn đã hoàn thành việc chọn phiên bản PHP cho từng tên miền rồi đó.

Nếu có bất kỳ thắc mắc nào, hãy liên hệ HostingViet để được hỗ trợ nhé.

Chúng tôi có thể hỗ trợ Bạn ngay cả khi Bạn chưa sử dụng dịch vụ của chúng tôi!

Adrian Wiik ¶

2 năm trước

Adrian Wiik ¶

2 năm trướcstring), integers (int), floating-point numbers (float), and booleans (bool). They augment the other types introduced in PHP 5: class names, interfaces, array and callable.

<?php
// Coercive mode
function sumOfInts(int ...$ints)
{
    return 
array_sum($ints);
}
var_dump(sumOfInts(2'3'4.1));

Ví dụ trên sẽ xuất ra:

Julian Sawicki ¶

Ricasiano tại Gmail Dot Com ¶

Terrye ¶

5 năm trước

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
1

Ví dụ trên sẽ xuất ra:

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)

Nevercode at pm dot me ¶

Tuyên bố loại vô hướng

Khai báo loại vô hướng có hai hương vị: cưỡng chế (mặc định) và nghiêm ngặt. Các loại sau đây cho các tham số hiện có thể được thực thi (một cách nghiêm khắc hoặc nghiêm ngặt): chuỗi (chuỗi), số nguyên (int), số điểm nổi (float) và booleans (bool). Họ tăng cường các loại khác được giới thiệu trong Php 5: tên lớp, giao diện, mảng và có thể gọi được.isset(). It returns its first operand if it exists and is not

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
3; otherwise it returns its second operand.

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
4

Để bật chế độ nghiêm ngặt, một chỉ thị cd /usr/local/directadmin/custombuild ./build update ./build set php1_release 7.1 ./build set php2_release 5.6 ./build set php3_release 7.0 ./build set php4_release 7.3 ./build set php1_mode php-fpm ./build set php2_mode php-fpm ./build set php3_mode php-fpm ./build set php4_mode php-fpm ./build php n ./build rewrite_confs0 phải được đặt ở đầu tệp. Điều này có nghĩa là sự nghiêm ngặt của việc gõ cho vô hướng được cấu hình trên cơ sở mỗi tệp. Chỉ thị này không chỉ ảnh hưởng đến các khai báo loại của các tham số, mà còn cả loại trả về của hàm (xem khai báo loại trả về, các hàm PHP tích hợp và các hàm từ các tiện ích mở rộng được tải.

Tài liệu đầy đủ và các ví dụ về khai báo loại vô hướng có thể được tìm thấy trong tham chiếu khai báo loại.

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
5

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
6

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
7

Trả lại loại khai báodefine()

Php 7 thêm hỗ trợ cho khai báo loại trả lại. Tương tự như khai báo loại đối số, khai báo loại trả về chỉ định loại giá trị sẽ được trả về từ một hàm. Các loại tương tự có sẵn cho các khai báo loại trả lại như có sẵn cho các khai báo loại đối số. constants can now be defined with define(). In PHP 5.6, they could only be defined with

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
8.

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.1
./build set php2_release 5.6
./build set php3_release 7.0
./build set php4_release 7.3
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php n
./build rewrite_confs
9

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
0

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
1

Các lớp ẩn danh

Hỗ trợ cho các lớp ẩn danh đã được thêm vào thông qua

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
2. Chúng có thể được sử dụng thay cho các định nghĩa lớp đầy đủ cho các đối tượng vứt bỏ:

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
3

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
4

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
5

Ví dụ trên sẽ xuất ra:

object(class@anonymous)#2 (0) {
}

Tài liệu đầy đủ có thể được tìm thấy trong tài liệu tham khảo lớp ẩn danh.

Unicode CodePoint Escap

Điều này có một codepoint Unicode ở dạng thập lục phân và đầu ra mà CodePoint trong UTF-8 đến chuỗi được trích dẫn kép hoặc heredoc. Bất kỳ CodePoint hợp lệ nào cũng được chấp nhận, với Tùy chọn của 0.

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
6

Ví dụ trên sẽ xuất ra:

ª
ª (same as before but with optional leading 0's)
香

Closure::call()

Tài liệu đầy đủ có thể được tìm thấy trong tài liệu tham khảo lớp ẩn danh. is a more performant, shorthand way of temporarily binding an object scope to a closure and invoking it.

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
7

Ví dụ trên sẽ xuất ra:

Tài liệu đầy đủ có thể được tìm thấy trong tài liệu tham khảo lớp ẩn danh.unserialize()

Unicode CodePoint Escap

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
8

Điều này có một codepoint Unicode ở dạng thập lục phân và đầu ra mà CodePoint trong UTF-8 đến chuỗi được trích dẫn kép hoặc heredoc. Bất kỳ CodePoint hợp lệ nào cũng được chấp nhận, với Tùy chọn của 0.

Đóng cửa :: Call () là một cách hiệu suất hơn, tốc ký tạm thời ràng buộc một phạm vi đối tượng để đóng và gọi nó.IntlChar class seeks to expose additional ICU functionality. The class itself defines a number of static methods and constants that can be used to manipulate unicode characters.

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
9

object(class@anonymous)#2 (0) {
}
0

object(class@anonymous)#2 (0) {
}
1

Ví dụ trên sẽ xuất ra:

10ffff
COMMERCIAL AT
bool(true)

Tài liệu đầy đủ có thể được tìm thấy trong tài liệu tham khảo lớp ẩn danh.

Unicode CodePoint Escap

Điều này có một codepoint Unicode ở dạng thập lục phân và đầu ra mà CodePoint trong UTF-8 đến chuỗi được trích dẫn kép hoặc heredoc. Bất kỳ CodePoint hợp lệ nào cũng được chấp nhận, với Tùy chọn của 0.assert() function. They allow for zero-cost assertions in production code, and provide the ability to throw custom exceptions when the assertion fails.

Đóng cửa :: Call () là một cách hiệu suất hơn, tốc ký tạm thời ràng buộc một phạm vi đối tượng để đóng và gọi nó.assert() is now a language construct, allowing the first parameter to be an expression rather than just a string to be evaluated or a bool value to be tested.

object(class@anonymous)#2 (0) {
}
2

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
4

Đã lọc unserialize ()

Ví dụ trên sẽ xuất ra:

Fatal error: Uncaught CustomError: Some error message

Tài liệu đầy đủ có thể được tìm thấy trong tài liệu tham khảo lớp ẩn danh.assert() reference.

Unicode CodePoint Escap

Điều này có một codepoint Unicode ở dạng thập lục phân và đầu ra mà CodePoint trong UTF-8 đến chuỗi được trích dẫn kép hoặc heredoc. Bất kỳ CodePoint hợp lệ nào cũng được chấp nhận, với Tùy chọn của 0.

object(class@anonymous)#2 (0) {
}
8

object(class@anonymous)#2 (0) {
}
9

ª
ª (same as before but with optional leading 0's)
香
0

Đóng cửa :: Call () là một cách hiệu suất hơn, tốc ký tạm thời ràng buộc một phạm vi đối tượng để đóng và gọi nó.

Đã lọc unserialize ()

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)
9

ª
ª (same as before but with optional leading 0's)
香
4

ª
ª (same as before but with optional leading 0's)
香
5

Ví dụ trên sẽ xuất ra:

Tính năng này tìm cách cung cấp bảo mật tốt hơn khi các đối tượng unserialization trên dữ liệu không đáng tin cậy. Nó ngăn chặn các bản ghi mã có thể bằng cách cho phép nhà phát triển vào các lớp danh sách trắng có thể không bị ảnh hưởng.

Intlchar

Lớp Intlchar mới tìm cách phơi bày chức năng ICU bổ sung. Bản thân lớp xác định một số phương thức tĩnh và hằng số có thể được sử dụng để thao tác các ký tự Unicode.Traversable object or array automatically, without needing to write boilerplate in the outermost generator by using the

ª
ª (same as before but with optional leading 0's)
香
6 construct.

ª
ª (same as before but with optional leading 0's)
香
7

ª
ª (same as before but with optional leading 0's)
香
8

ª
ª (same as before but with optional leading 0's)
香
9

Ví dụ trên sẽ xuất ra:

Để sử dụng lớp này, phần mở rộng INTL phải được cài đặt.intdiv()

Kỳ vọngintdiv() function performs an integer division of its operands and returns it.

10ffff
COMMERCIAL AT
bool(true)
0

Ví dụ trên sẽ xuất ra:

Kỳ vọng là một tăng cường tương thích ngược với hàm Assert () cũ hơn. Chúng cho phép các xác nhận không có chi phí trong mã sản xuất và cung cấp khả năng ném các ngoại lệ tùy chỉnh khi khẳng định thất bại.

Mặc dù API cũ tiếp tục được duy trì để tương thích, Assert () hiện là một cấu trúc ngôn ngữ, cho phép tham số đầu tiên là một biểu thức thay vì chỉ là một chuỗi được đánh giá hoặc giá trị bool được kiểm tra. now accepts an array of options that override the session configuration directives normally set in php.ini.

object(class@anonymous)#2 (0) {
}
4session_start() to indicate that the session data should be read and then the session should immediately be closed unchanged.

Chi tiết đầy đủ về tính năng này, bao gồm cách định cấu hình nó trong cả môi trường phát triển và sản xuất, có thể được tìm thấy trong phần kỳ vọng của tham chiếu Assert ().

10ffff
COMMERCIAL AT
bool(true)
3

preg_replace_callback_array()

Tuyên bố nhóm

object(class@anonymous)#2 (0) {
}
5preg_replace_callback_array() function enables code to be written more cleanly when using the preg_replace_callback() function. Prior to PHP 7, callbacks that needed to be executed per regular expression required the callback function to be polluted with lots of branching.

Các lớp, chức năng và hằng số được nhập từ cùng một

object(class@anonymous)#2 (0) {
}
6 hiện có thể được nhóm lại với nhau trong một câu lệnh
object(class@anonymous)#2 (0) {
}
5.

Chức năng CSPRNG

Hai hàm mới đã được thêm vào để tạo các số nguyên và chuỗi bảo mật bằng mã hóa theo cách chéo: Random_Bytes () và Random_int ().random_bytes() and random_int().

Danh sách () luôn có thể giải nén các đối tượng triển khai ArrayAccess can always unpack objects implementing ArrayAccess

Trước đây, List () không được đảm bảo hoạt động chính xác với các đối tượng triển khai ArrayAccess.Điều này đã được sửa chữa.list() was not guaranteed to operate correctly with objects implementing ArrayAccess. This has been fixed.

Các tính năng khác

  • Truy cập thành viên lớp trên nhân bản đã được thêm vào, ví dụ:
    10ffff
    COMMERCIAL AT
    bool(true)
    
    4.

Paweld ¶

6 năm trước

10ffff
COMMERCIAL AT
bool(true)
5

10ffff
COMMERCIAL AT
bool(true)
6

10ffff
COMMERCIAL AT
bool(true)
7

10ffff
COMMERCIAL AT
bool(true)
8

10ffff
COMMERCIAL AT
bool(true)
9

Adrian Wiik ¶

2 năm trước

Fatal error: Uncaught CustomError: Some error message
0

Fatal error: Uncaught CustomError: Some error message
1

10ffff
COMMERCIAL AT
bool(true)
9

Julian Sawicki ¶

2 năm trước

Fatal error: Uncaught CustomError: Some error message
3

Fatal error: Uncaught CustomError: Some error message
4

10ffff
COMMERCIAL AT
bool(true)
9

Julian Sawicki ¶

2 năm trước

Fatal error: Uncaught CustomError: Some error message
6

Fatal error: Uncaught CustomError: Some error message
7

Fatal error: Uncaught CustomError: Some error message
8

Fatal error: Uncaught CustomError: Some error message
9

Julian Sawicki ¶

2 năm trước

int0

int1

10ffff
COMMERCIAL AT
bool(true)
9

Julian Sawicki ¶

Ricasiano tại Gmail Dot Com ¶

int3

int4

int5

10ffff
COMMERCIAL AT
bool(true)
9

Terrye ¶

2 năm trước

int7

int8

int9

10ffff
COMMERCIAL AT
bool(true)
9