Инструменты пользователя

Инструменты сайта


linux:php:install_php_8.0_on_ubuntu

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
linux:php:install_php_8.0_on_ubuntu [2022/06/02 10:42]
werwolf [Step 1: Добавьте репозиторий Ondrej Surý PPA]
linux:php:install_php_8.0_on_ubuntu [2023/01/12 12:18] (текущий)
Строка 14: Строка 14:
 But first, let’s update your **Ubuntu** system packages and install some dependencies as shown. But first, let’s update your **Ubuntu** system packages and install some dependencies as shown.
  
-<​code>​+<​code ​powershell>
 $ sudo apt update $ sudo apt update
 $ sudo apt upgrade $ sudo apt upgrade
Строка 20: Строка 20:
 </​code>​ </​code>​
  
-AD 
  
 Затем добавьте **Ondrej PPA**. Затем добавьте **Ondrej PPA**.
  
-<​code>​+<​code ​powershell>
 $ sudo add-apt-repository ppa:​ondrej/​php $ sudo add-apt-repository ppa:​ondrej/​php
 </​code>​ </​code>​
Строка 33: Строка 32:
  
  
-==== Step 2: Install ​PHP 8.0 with Apache ​on Ubuntu ====+==== Step 2: Установите ​PHP 8.0 с Apache ​на Ubuntu ====
  
-Nextupdate the system repositories to start using the **PPA**.+Затем обновите системные репозиториичтобы начать использовать ​**PPA**.
  
 <​code>​ <​code>​
Строка 41: Строка 40:
 </​code>​ </​code>​
  
-If you are running the [[https://​www.tecmint.com/​install-apache-web-server-on-ubuntu-20-04/​|Apache ​web server]], install ​**PHP 8.0** with the Apache ​module as shown.+Если вы используете ​[[https://​www.tecmint.com/​install-apache-web-server-on-ubuntu-20-04/​|веб-сервер ​Apache]], ​установите ​**PHP 8.0** с Apache ​модуль,​ как показано.
  
 <​code>​ <​code>​
Строка 47: Строка 46:
 </​code>​ </​code>​
  
-[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png?​877x332|Install PHP 8 in Ubuntu}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png?​877x332|Install PHP 8 in Ubuntu}}]] ​Install ​PHP 8 in Ubuntu+[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png?​877x332|Install PHP 8 in Ubuntu}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Install-PHP-8-in-Ubuntu-with-Apache.png?​877x332|Install PHP 8 in Ubuntu}}]] 
 +\\ 
 +Установите ​PHP 8 в Ubuntu
  
-Next, restart the Apache ​webserver to enable the module.+Затем перезапустите веб-сервер ​Apache, чтобы включить модуль.
  
 <​code>​ <​code>​
Строка 55: Строка 56:
 </​code>​ </​code>​
  
-If you want to use Apache ​webserver with **PHP-FPM**, ​run the command below to install the required packages:+Если вы хотите использовать веб-сервер ​Apache ​с **PHP-FPM**, ​выполните приведенную ниже команду,​ чтобы установить необходимые пакеты:
  
 <​code>​ <​code>​
 $ sudo apt install php8.0-fpm libapache2-mod-fcgid $ sudo apt install php8.0-fpm libapache2-mod-fcgid
 </​code>​ </​code>​
- +Поскольку ​**PHP-FPM** ​не включен по умолчаниювключите его, выполнив следующие команды:
-Since **PHP-FPM** ​is not enabled by defaultenable it by invoking the following commands:+
  
 <​code>​ <​code>​
Строка 68: Строка 68:
 </​code>​ </​code>​
  
-Then restart the Apache ​webserver for the changes to come into effect.+Затем перезапустите веб-сервер ​Apache, чтобы изменения вступили в силу.
  
 <​code>​ <​code>​
Строка 74: Строка 74:
 </​code>​ </​code>​
  
-[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png?​539x270|Enable PHP-FPM in Apache}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png?​539x270|Enable PHP-FPM in Apache}}]] ​Enable ​PHP-FPM ​in Apache+[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png?​539x270|Enable PHP-FPM in Apache}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Enable-PHP-FPM-in-Apache.png?​539x270|Enable PHP-FPM in Apache}}]] ​ 
 + 
 +\\ 
 +Включить ​PHP-FPM ​в Apache
  
 ==== Step 2: Install PHP 8.0 with Nginx on Ubuntu ==== ==== Step 2: Install PHP 8.0 with Nginx on Ubuntu ====
 +Если вы решите использовать **PHP 8.0** с **[[https://​www.tecmint.com/​install-nginx-on-ubuntu-20-04/​|установка Nginx]]**, наиболее рекомендуемый шаг нужно установить **PHP-FPM** для обработки файлов PHP.
  
-If you choose to use **PHP 8.0** with **[[https://​www.tecmint.com/​install-nginx-on-ubuntu-20-04/​|Nginx installation]]**,​ the most recommended step to take is to install ​**PHP-FPM** ​to process PHP files.+Поэтому установите ​**PHP** ​и **PHP-FPM** ​с помощью следующей команды:​
  
-Therefore, install **PHP** and **PHP-FPM** using the following command: +<​code ​powershell>
- +
-<​code>​+
 $ sudo apt install php8.0-fpm $ sudo apt install php8.0-fpm
 </​code>​ </​code>​
  
-The **PHP-FPM** ​service should start automaticallyYou can verify this as shown:+Служба ​**PHP-FPM** ​должна запуститься автоматическиВы можете проверить это, как показано:
  
 <​code>​ <​code>​
Строка 92: Строка 94:
 </​code>​ </​code>​
  
-[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png?​905x310|Verify PHP-FPM in Nginx}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png?​905x310|Verify PHP-FPM in Nginx}}]] Verify ​PHP-FPM ​in Nginx+[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png?​905x310|Verify PHP-FPM in Nginx}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-FPM-in-Nginx.png?​905x310|Verify PHP-FPM in Nginx}}] 
 +\\ 
 +Проверить ​PHP-FPM ​в Nginx 
 +Чтобы Nginx мог обрабатывать файлы **PHP**, настройте блок сервера Nginx, обновив раздел сервера,​ как показано ниже:
  
-For Nginx to process **PHP** files, configure your Nginx server block by updating the server section as shown: +<​code ​powershell
- +
-<​code>​+
 server { server {
  
Строка 110: Строка 113:
 Finally, restart the Nginx web server for the changes to come into effect. Finally, restart the Nginx web server for the changes to come into effect.
  
-<​code>​+<​code ​powershell>
 $ sudo systemctl restart nginx $ sudo systemctl restart nginx
 </​code>​ </​code>​
  
-==== Step 4: Install PHP 8 Extensions in Ubuntu ==== 
- 
-PHP extensions are libraries that extend the functionality of PHP. These extensions exist as packages and can be installed as follows: 
- 
-<​code>​ 
-$ sudo apt install php8.0-[extension-name] 
-</​code>​ 
- 
-For instance, the example below installs the **SNMP**, **Memcached**,​ and **MySQL** extensions. 
- 
-<​code>​ 
-$ sudo apt install php8.0-snmp php-memcached php8.0-mysql 
-</​code>​ 
- 
-==== Step 5: Verify PHP 8 Installation in Ubuntu ==== 
- 
-To confirm the version of PHP installed, run the command: 
- 
-<​code>​ 
-$ php -v 
-</​code>​ 
- 
-[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-in-Ubuntu.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-in-Ubuntu.png?​574x140|Verify PHP in Ubuntu}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-in-Ubuntu.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Verify-PHP-in-Ubuntu.png?​574x140|Verify PHP in Ubuntu}}]] Verify PHP in Ubuntu 
- 
-Additionally,​ you can create a sample php file at **/​var/​www/​html** as shown: 
- 
-<​code>​ 
-$ sudo vim /​var/​www/​html/​info.php 
-</​code>​ 
- 
-Paste the following lines and save the file. 
- 
-<​code>​ 
-<?php 
- 
-phpinfo(); 
- 
-?> 
-</​code>​ 
- 
-Finally, head over to your browser and browse the server’s IP address as shown. 
- 
-<​code>​ 
-http://​server-ip/​info.php 
-</​code>​ 
- 
-You should get the webpage shown. 
- 
-[[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Check-PHP-8-Info-in-Ubuntu.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Check-PHP-8-Info-in-Ubuntu.png?​1153x531|Check PHP 8 Info in Ubuntu}}]] [[https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Check-PHP-8-Info-in-Ubuntu.png|{{https://​www.tecmint.com/​wp-content/​uploads/​2020/​12/​Check-PHP-8-Info-in-Ubuntu.png?​1153x531|Check PHP 8 Info in Ubuntu}}]] Check PHP 8 Info in Ubuntu 
- 
-== Conclusion == 
- 
-It’s our hope that you can now install **PHP 8.0** and comfortably integrate it with either **Apache** or **Nginx** web servers. Your feedback is most welcome. 
- 
-Tags [[https://​www.tecmint.com/​tag/​php-tips/​|PHP Tips]], [[https://​www.tecmint.com/​tag/​ubuntu-tips/​|Ubuntu Tips]] 
- 
-Post navigation 
- 
-[[https://​www.tecmint.com/​boot-ubuntu-in-rescue-mode/​|How to Boot into Rescue Mode Or Emergency Mode In Ubuntu 20.04 / 18.04]] 
- 
-[[https://​www.tecmint.com/​install-php-8-on-centos/​|How to Install PHP 8 on CentOS/RHEL 8/7]] 
- 
-If you liked this article, then do [[https://​newsletter.tecmint.com/​subscription?​f=hj6Ohm9gck3Z0PQ2BBBTh892iaCbDV3jJJa3hD8ULUlubOgnbo8aF44vt2HZfdc36g|subscribe to email alerts]] for Linux tutorials. If you have any questions or doubts? do [[https://​www.tecmint.com/​install-php-8-on-ubuntu/#​comments|ask for help in the comments]] section. 
- 
-AD 
- 
-===== If You Appreciate What We Do Here On TecMint, You Should Consider: ===== 
- 
-TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all. 
  
-If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation. 
  
-[[https://​www.buymeacoffee.com/​tecmint|{{https://​www.tecmint.com/​wp-content/​uploads/​2015/​01/​coffee.png|Support Us}}]]**We are thankful for your never ending support.** 
  
  
linux/php/install_php_8.0_on_ubuntu.1654155763.txt.gz · Последние изменения: 2023/01/12 12:16 (внешнее изменение)