> For the complete documentation index, see [llms.txt](https://premium.gitbook.io/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://premium.gitbook.io/main/osnovnye-nastroiki/faq/obnovlenie-failov-skripta-na-servere/kak-obnovit-php.md).

# Как обновить PHP

Обновление PHP с версии 8.1 на 8.2 на Ubuntu (пример)

Выполнив следующие шаги, вы сможете перейти на новую версию PHP.

### Шаг 1: [Прежде всего, проверьте версию PHP](https://premium.gitbook.io/main/osnovnye-nastroiki/faq/kak-proverit-versiyu-php-ustanovlennuyu-na-servere)

### Шаг 2: Добавьте репозиторий PHP

Для обновления до PHP 8.2 необходимо добавить репозиторий PHP в систему. Чтобы добавить репозиторий, введите в консоль следующие инструкции.

{% code overflow="wrap" %}

```nginx
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
```

{% endcode %}

### Шаг 3: Обновите PHP

Вы можете обновить PHP до версии 8.2 после добавления репозитория и обновления системы.

{% code overflow="wrap" %}

```nginx
sudo apt install php8.2
```

{% endcode %}

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

### Шаг 4: После обновления проверьте наличие обновления PHP

Выполните следующую команду, чтобы убедиться, что PHP 8.2 установлен после завершения установки.

```nginx
php -v
```

### Шаг 5: Установка пакетов PHP 8.2

Вы можете установить некоторые расширения PHP с помощью управления пакетами apt, если они вам нужны для ваших проектов.

{% code overflow="wrap" %}

```nginx
sudo apt install php8.2
```

{% endcode %}

### Шаг 6: Перезапуск веб-сервера

Перезапуск веб-сервера необходим для того, чтобы изменения вступили в силу, если вы используете PHP с веб-сервером Apache или Nginx.

{% code overflow="wrap" %}

```nginx
sudo service apache2 restart # Для Apache
sudo service nginx restart # Для Nginx
```

{% endcode %}

Примечание: Вы можете использовать следующую команду, чтобы выбрать новую версию PHP из списка, если он все еще показывает устаревшую версию PHP.

{% code overflow="wrap" %}

```nginx
sudo update-alternatives --config php
```

{% endcode %}

Проверьте повторно версию PHP, на которой работает ваш веб-сервер.

### Замена версии PHP для работы скрипта Premium Exchanger

Скачайте и загрузите дистрибутив под **установленную версию скрипта и новую версию PHP.**

**Файлы для установки** — при установке скрипта с нуля

**Файлы для обновления** — при обновлении установленного скрипта

<figure><img src="/files/NJGKJHXjYdf6OEYiGWV3" alt=""><figcaption></figcaption></figure>

Загрузите архив на сервер в корневую папку и распакуйте его с заменой существующих файлов

<figure><img src="/files/8K1ybZezadU7V5UDbnQ3" alt="" width="491"><figcaption></figcaption></figure>

В ISP Manager смените версию PHP для вашего сайта на новую и сохраните изменения.

<figure><img src="/files/IdOscZdfGUYVINGb16nA" alt="" width="467"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://premium.gitbook.io/main/osnovnye-nastroiki/faq/obnovlenie-failov-skripta-na-servere/kak-obnovit-php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
