Cài đặt php5 trong Ubuntu
Tôi đang chạy tất cả các bước trong hướng dẫn này với quyền root, vì vậy hãy đảm bảo rằng bạn đã đăng nhập với quyền root Show sudo su
2 Cài đặt MySQL 5Đầu tiên chúng tôi cài đặt MySQL 5 như thế này apt-get cài đặt mysql-máy chủ mysql-client Bạn sẽ được yêu cầu cung cấp mật khẩu cho người dùng root MySQL - mật khẩu này cũng hợp lệ cho người dùng [email protected] . [email protected], so we don't have to specify a MySQL root password manually later on: Mật khẩu mới cho người dùng "root" MySQL. <-- yourrootsqlpassword
3 Cài đặt Apache2Apache2 được cài đặt mặc định trong ubuntu14. 04, Chưa cài thì cài. Apache2 có sẵn dưới dạng gói Ubuntu, do đó chúng ta có thể cài đặt nó như thế này apt-get cài đặt apache2 Bây giờ hãy hướng trình duyệt của bạn tới http. //192. 168. 0. 100 và bạn sẽ thấy trang giữ chỗ của Apache2 ( Nó hoạt động. ). Thêm PPA trong Ubuntu2. Tiếp theo, cập nhật hệ thống như sau $ sudo apt-get update 3. Bây giờ hãy cài đặt các phiên bản PHP được hỗ trợ khác nhau như sau Đối với máy chủ web Apache$ sudo apt install php5.6 [PHP 5.6] $ sudo apt install php7.0 [PHP 7.0] $ sudo apt install php7.1 [PHP 7.1] $ sudo apt install php7.2 [PHP 7.2] $ sudo apt install php7.3 [PHP 7.3] $ sudo apt install php7.4 [PHP 7.4] $ sudo apt install php8.0 [PHP 8.0] Đối với máy chủ web Nginx$ sudo apt install php5.6-fpm [PHP 5.6] $ sudo apt install php7.0-fpm [PHP 7.0] $ sudo apt install php7.1-fpm [PHP 7.1] $ sudo apt install php7.2-fpm [PHP 7.2] $ sudo apt install php7.3-fpm [PHP 7.3] $ sudo apt install php7.4-fpm [PHP 7.4] $ sudo apt install php8.0-fpm [PHP 8.0] 4. Để cài đặt bất kỳ mô-đun PHP nào, chỉ cần chỉ định phiên bản PHP và sử dụng chức năng tự động hoàn thành để xem tất cả các mô-đun như sau ------------ press Tab key for auto-completion ------------ $ sudo apt install php5.6 $ sudo apt install php7.0 $ sudo apt install php7.1 $ sudo apt install php7.2 $ sudo apt install php7.3 $ sudo apt install php7.4 $ sudo apt install php8.0Tìm kiếm các mô-đun PHP 5. Bây giờ bạn có thể cài đặt các mô-đun PHP cần thiết nhất từ danh sách ------------ Install PHP Modules ------------ $ sudo apt install php5.6-cli php5.6-xml php5.6-mysql $ sudo apt install php7.0-cli php7.0-xml php7.0-mysql $ sudo apt install php7.1-cli php7.1-xml php7.1-mysql $ sudo apt install php7.2-cli php7.2-xml php7.2-mysql $ sudo apt install php7.3-cli php7.3-xml php7.3-mysql $ sudo apt install php7.3-cli php7.4-xml php7.4-mysql $ sudo apt install php7.3-cli php8.0-xml php8.0-mysql 6. Cuối cùng, xác minh phiên bản PHP mặc định được sử dụng trên hệ thống của bạn như thế này $ php -vKiểm tra phiên bản PHP mặc định trong Ubuntu Đặt phiên bản PHP mặc định trong Ubuntu7. Bạn có thể thiết lập phiên bản PHP mặc định sẽ sử dụng trên hệ thống bằng lệnh update-alternatives, sau khi thiết lập xong kiểm tra lại phiên bản PHP để xác nhận như sau ______6_______0Đặt PHP 5. 6 trong UbuntuPackage: php Version: 1:7.0+35ubuntu6 Priority: optional Section: php Source: php-defaults (35ubuntu6) Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian PHP Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 11.3 kB Depends: php7.0 Supported: 5y Download-Size: 2,832 B APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages Description: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0).1Đặt PHP 7. 0 trong Ubuntu Package: php Version: 1:7.0+35ubuntu6 Priority: optional Section: php Source: php-defaults (35ubuntu6) Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian PHP Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 11.3 kB Depends: php7.0 Supported: 5y Download-Size: 2,832 B APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages Description: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0).2Đặt PHP 7. 1 trong Ubuntu Package: php Version: 1:7.0+35ubuntu6 Priority: optional Section: php Source: php-defaults (35ubuntu6) Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian PHP Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 11.3 kB Depends: php7.0 Supported: 5y Download-Size: 2,832 B APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages Description: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0).3Đặt phiên bản PHP 8 8. Để đặt phiên bản PHP sẽ hoạt động với máy chủ web Apache, hãy sử dụng các lệnh bên dưới. Đầu tiên, tắt phiên bản hiện tại bằng lệnh a2dismod và sau đó bật phiên bản bạn muốn bằng lệnh a2enmod Package: php Version: 1:7.0+35ubuntu6 Priority: optional Section: php Source: php-defaults (35ubuntu6) Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian PHP Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 11.3 kB Depends: php7.0 Supported: 5y Download-Size: 2,832 B APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages Description: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0).4Bật Tắt các mô-đun PHP cho Apache 9. Sau khi chuyển từ phiên bản này sang phiên bản khác, bạn có thể tìm thấy tệp cấu hình PHP của mình bằng cách chạy lệnh bên dưới Package: php Version: 1:7.0+35ubuntu6 Priority: optional Section: php Source: php-defaults (35ubuntu6) Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian PHP Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 11.3 kB Depends: php7.0 Supported: 5y Download-Size: 2,832 B APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages Description: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian's default PHP version (currently 7.0).5Tìm tệp cấu hình PHP Bạn cũng có thể thích
Trong bài viết này, chúng tôi đã hướng dẫn cách cài đặt tất cả các phiên bản PHP được hỗ trợ trong Ubuntu và các dẫn xuất của nó. Nếu bạn có bất kỳ câu hỏi hoặc suy nghĩ nào muốn chia sẻ, hãy làm như vậy thông qua biểu mẫu phản hồi bên dưới Làm cách nào để cài đặt php5 6 trên Ubuntu?Cài đặt PHP 5. 6 . Bước 1. Cập nhật Apt-Get Bước 2. Cài đặt PHP5. 6. Cài đặt PHP5. 6 kho lưu trữ với hai lệnh này Bước 3. Chuyển đổi PHP 7. 0 to PHP 5. 6. Chuyển từ PHP 7. 0 to PHP 5. 6 trong khi khởi động lại Apache để nhận ra sự thay đổi Bước 4. Chỉnh sửa nhị phân PHP Cách cài đặt PHP 7. 2 5 trên Ubuntu?Cách cài đặt PHP 7. 2 trên Ubuntu 16. 04 / 18. 04 / 18. 10 . điều kiện tiên quyết. Có Ubuntu 16. 04 x64 / 18. 01 x64 / 18. ví dụ 10 x64. . Bước 1. Cài đặt PPA của Ondřej Surý. . Bước 2. Cài đặt PHP 7. 2 & Tiện ích mở rộng PHP. . Bước 3. Kiểm tra cài đặt PHP. . Bước 4. Khởi động lại Apache2 Làm cách nào để cài đặt phiên bản cụ thể của PHP trong Ubuntu?Cài đặt PHP (5. 6, 7. . Trước tiên, hãy bắt đầu bằng cách thêm Ondřej Surý PPA để cài đặt các phiên bản PHP khác nhau – PHP 5. 6, PHP7. x và PHP 8. 0 trên hệ thống Ubuntu. . Tiếp theo, cập nhật hệ thống như sau. $ sudo apt-get cập nhật Bây giờ hãy cài đặt các phiên bản PHP được hỗ trợ khác nhau như sau |