Какую версию php выбрать

от admin

Выбрать версию PHP под определенную CMS и не плакать

“Я же сказал — полетели, а не побежали!”
“Давай, страус, пошел! Работаем, работаем!”

PHP сейчас один из самых популярных языков программирования, используемых для создания сайтов. На shared linux веб хостинге в России с выбором версии PHP не совсем гладко, хотя встречаются исключения из этого правила.
Почему выбор версии необходим? Интересно? Добро пожаловать под кат!

Рассмотрим системные требования самых распостраненных CMS на рынке России — WordPress, Bitrix, Drupal и Joomla к версиям PHP (про модули говорить не будем, это тема для отдельной статьи):

    8: PHP 5.5.9 or higher : PHP 5.3 or higher 3.4.7: PHP 5.5 or higher 4.4: PHP 5.2.4 or higher
    :

    • 6 – PHP 5.3
    • 7 – PHP 5.4
    • 7 – PHP 5.4
    • 8 – PHP 5.6
    • 13 – PHP 5.4
    • 14 – PHP 5.5

    У себя мы используем CloudLinux, который по пакетной базе соответствует CentOS 6.7. Ситуация “из коробки” не радужная – версии PHP весьма старые.
    А те клиенты, у которых сайт создан давно и CMS не обновлялась (а таких немало приходит к нам с других хостингов) как правило хотят ровно обратного — более старых версий PHP из-за того, что на их CMS имеются проблемы с совместимостью.
    Так что выходов два: либо собирать самому из исходников, либо ставить из сторонних репозиториев, что не всегда возможно.

    • Постоянно пересобирать пакеты из исходников?
    • Зависеть от сторонних репозиториев (людей)?
    • Следить за баг трэками для оперативного внесения заплаток?
    • Держать несколько VPS или dedicated серверов с разной версией PHP для различных WEB проектов (а ещё и для разработки)?
    • Уменьшение трудозатрат, как на развертывание, так и на сопровождение проектов.
    • Возможность выбрать версию PHP не обращаясь к техподдержке. Переключение версий происходит меньше чем за минуту!
    • Бэкап и доступ к консоли или каталогам по безопасному протоколу SSH. Также и проверенным способом – протоколом FTP.
    • Катастрофоустойчивость – возможность быстрого развертывания инфраструктуры в другом ЦОД`е.
    • Создать собственный репозиторий и систему обновлений для него. Что стоило для нас появлением у сотрудников красных глаз. Сборки PHP (5.2 — 5.6) мы собирали со своими параметрами, для того чтобы установить и использовать их параллельно в одной системе.
    • Создать на портале самообслуживания страницы управления.
    • Внедрить обученного агента в CloudLinux для биллинга и управления услугами из ЛК. На момент разработки агента в CloudLinux еще небыло такого функционала как PHP Selector, поэтому данную функцию выполняет сам агент.

    Немного остановлюсь на агенте, который взаимодействует между ЛК и системой где развернут хостинг. Агент (написан на питоне) представляет из себя службу с документированным api, позволяющую взаимодействовать с CloudLinux`ом. в качестве оркестратора. Касаемо PHP — агент позволяет изменить версию и настройки для определенного клиента. При создании новой услуги (пользователя) агент использует предустановленные настройки, которые позже можно сменить на кастомные.

    Если интересно узнать как все это устроено более детально, жду комментарии по наиболее интересным моментам.

    Если вы увидите какие-либо ошибки в статье — пишите пожалуйста об этом в личку.

    WordPress PHP Versions: Best PHP for WordPress in 2023

    FI WordPress PHP Version Compatibility

    Different WordPress versions can work with multiple PHP versions. Yet, the platform recommends specific PHP requirements for each WP version. Choosing the best WordPress PHP version is crucial to make sure that the website is secure and free of bugs.

    This article discusses the compatibility between PHP and WordPress in terms of the recommended, minimum, and latest PHP versions for WordPress.

    IMPORTANT: This article is being checked and updated regularly by our team to reflect the most accurate and up-to-date information. In case you found anything incorrect or inaccurate please don’t hesitate to contact us.

    LAST UPDATED: January 05, 2023

    In this article:

    1. Overview

    WordPress substantially relies on PHP to work and operate. Updates for both platforms are being published regularly to fix security loopholes and bring enhancements in usability and performance. Thus, WordPress users have to continuously update their software and confirm its compatibility with supported PHP versions.

    WordPress PHP versions depend on the compatibility between WordPress and PHP. As each version of WP requires specific minimum PHP requirements. In this context, this article aims to explore the compatibility of the multiple versions of WordPress with PHP, in light of continuous updates being published on a regular basis for both platforms.

    2. Supported PHP Versions

    Updates of PHP programming language are being published regularly. The updates usually include bug fixes and security improvements besides other functional and performance enhancements.

    When published, each PHP version remains supported for a period of 3 years from its initial stable release , the support period runs over two main successive phases:

    • 2-Years Active Support: the support includes fixing BOTH BUGS and SECURITY ISSUES.
    • 1-Year Security Support: the support includes fixing ONLY CRITICAL SECURITY ISSUES.

    PHP Versions Lifetime

    PHP versions lifetime and support phases

    Once the support period is completed (after 3 years), the version reaches its end of life (EOL) and becomes no longer supported. It’s strongly not recommended to use an unsupported version of PHP as it might expose the application using it to security vulnerabilities and bugs.

    3. WordPress Current PHP Versions

    The official PHP website maintains a specific webpage to check the status of supported versions. Accordingly, the currently supported PHP versions that can be safely used for WordPress are:

    • PHP Version 7.4– No Longer Supported
    • PHP Version 8.0(Security Support, ends on 26/11/2023)
    • PHP Version 8.1(Active Support, ends on 25/11/2023)
    • PHP Version 8.2(Active Support, ends on 08/12/2024)

    When an older PHP version runs out of support, it is removed from the list and, usually, a new version with full support is added.

    4. WordPress PHP Requirements

    In general, WordPress requires specific server requirements, which cover PHP requirements, hosting details, and other software dependencies.

    Technically speaking, each version of WordPress has specific PHP versions that it is compatible with. That being said, although the software might work on legacy PHP versions that reached their End Of Life, the platform recommends using only supported PHP versions.

    Important: a compatible PHP version is a version that WordPress requires to work properly, regardless of whether it is still supported or not.

    Here is a list of the compatible PHP versions for each version of WordPress, knowing that we only consider WP versions that can work with the currently supported PHP versions:

    WordPress 6.1 PHP version is: 5.6 up to 8.2
    WordPress 6.0 PHP version is: 5.6 up to 8.1
    WordPress 5.9 PHP version is: 5.6 up to 8.1
    WordPress 5.8 PHP version is: 5.6 up to 8.0
    WordPress 5.7 PHP version is: 5.6 up to 8.0
    WordPress 5.6 PHP version is: 5.6 up to 8.0

    For details about PHP requirements for older versions of WordPress, please check this official blog.

    5. WordPress Minimum PHP Versions

    In terms of PHP requirements, each version of WordPress has a particular minimum PHP version. However, WordPress recommends always using the minimum supported version of PHP regardless of the used WordPress installation.

    WordPress Minimum PHP Version is: PHP 8.0

    WordPress Minimum (UNSUPPORTED) PHP Version is: PHP 5.6.20+ (this version is no longer supported and may expose your site to critical vulnerabilities)

    As WordPress recommends, we highly urge you not to use the minimum version in case it is not supported, even if it is compatible with your website’s WordPress version.

    For this reason, we mention here the minimum PHP requirements for each WordPress installation. Knowing that we cover only WordPress versions that are compatible with supported PHP versions.

    Here is a list of the minimum PHP versions for WordPress:

    WordPress Version Minimum PHP Version Minimum (SUPPORTED) PHP Version
    WordPress 6.1
    WordPress 6.1.x
    PHP 5.6 PHP 8.0
    WordPress 6.0
    WordPress 6.0.x
    PHP 5.6 PHP 8.0
    WordPress 5.9
    WordPress 5.9.x
    PHP 5.6 PHP 8.0
    WordPress 5.8
    WordPress 5.8.x
    PHP 5.6 PHP 8.0
    WordPress 5.7
    WordPress 5.7.x
    PHP 5.6 PHP 8.0
    WordPress 5.6
    WordPress 5.6.x
    PHP 5.6 PHP 8.0

    WordPress Minimum PHP Versions

    For more details about minimum PHP requirements for other WordPress versions please refer to this official blog.

    6. What Is The Recommended PHP Version For WordPress?

    As mentioned earlier, each WordPress installation requires specific PHP requirements. That said, the best and recommended PHP version for WordPress depends on which version of WordPress is being used.

    WordPress Recommended PHP Version is the latest supported version which is compatible with your website’s WordPress version.

    Here is a list of the recommended PHP version for each WordPress, we only mention WP versions that are compatible with supported PHP versions:

    WordPress Version Recommended PHP Version
    WordPress 6.1
    WordPress 6.1.x
    PHP 8.x*
    WordPress 6.0
    WordPress 6.0.x
    PHP 8.0* | PHP 8.1*
    WordPress 5.9
    WordPress 5.9.x
    PHP 8.0* | PHP 8.1*
    WordPress 5.8
    WordPress 5.8.x
    PHP 8.0*
    WordPress 5.7
    WordPress 5.7.x
    PHP 8.0*
    WordPress 5.6
    WordPress 5.6.x
    PHP 8.0*

    WordPress Recommended PHP Versions

    * Beta support: This means the compatibility of WordPress with PHP is still being tested. If you prefer to avoid any hassles or you found it difficult to upgrade to a beta-support PHP version, we recommend using the latest fully-supported PHP version till the beta test ends. You can just follow this article for future updates.

    7. What Is The Latest PHP Version for WordPress?

    PHP work on a continuous basis to update their framework and fix bugs and security issues. Similarly, WordPress aims to support new versions of PHP as they are being published.

    The latest version of PHP that is currently supported by WordPress is PHP 8.2 and it’s supported by WP 6.1.

    Nevertheless, the compatibility of WordPress with PHP 8.x is still in the beta support phase. That said, most WordPress functionalities will work but you might expect some minor issues to happen sometimes.

    Furthermore, some plugins and themes might be not yet compatible with PHP 8.x. So we recommended checking the compatibility of your addons before updating to recent versions of PHP.

    8. How To Check WordPress PHP Version?

    To find the PHP version being used by your WP installation, you just need to follow the following simple steps:

    1. Log in to your WP Admin Dashboard .
    2. Navigate to the sidebar menu and choose: Tools then Site Health .
    3. From the opened interface, choose Info tab.
    4. From the list displayed, navigate to Server section and click on the small arrow to expand it.
    5. Here you will find your PHP version as well as other server details.

    WordPress Check PHP Version

    WordPress used PHP version in Admin Dashboard

    To read our easy guide with pictures to finding PHP version in WordPress without a plugin please refer to this article. In case you are unable to access the admin control panel, you can find the PHP version by accessing your hosting cPanel or consulting your hosting service provider.

    FI Check WordPress Php Version Without Plugin

    How to Check PHP Version in WordPress Without Plugin?

    There are many ways to check the PHP version being used by a WordPress installation, usually using third-party plugins. In this article, we will find step-by-step how to check PHP version in WordPress without any plugin.

    9. Conclusion

    To avoid vulnerabilities and obtain the best performance for your website, WordPress and PHP versions should be always compatible with each other.

    In this article, we discussed the PHP requirements of WordPress platform in terms of compatibility and possibly usable PHP versions.

    Supported Versions

    Each release branch of PHP is fully supported for two years from its initial stable release. During this period, bugs and security issues that have been reported are fixed and are released in regular point releases.

    After this two year period of active support, each branch is then supported for an additional year for critical security issues only. Releases during this period are made on an as-needed basis: there may be multiple point releases, or none, depending on the number of reports.

    Once the three years of support are completed, the branch reaches its end of life and is no longer supported. A table of end of life branches is available.

    Какую версию PHP выбрать для сайта?

    На первый взгляд ответ простой — последнюю.))) Я тоже так считаю, но когда я скачивал PHP 5.3 (5.3.8) VC9 для Windows, то увидел следующую информацию:

    **Какую версию выбрать?

    -Если вы используете PHP с Apache 1 или Apache2 от apache.org вам нужно использовать VC6 версий PHP

    -Если вы используете PHP с IIS вы должны использовать VC9 версий PHP

    -VC6 Версии составляются с наследием Visual Studio 6 компилятор

    -VC9 Версии составляются с Visual Studio 2008 компилятор и есть улучшения в производительности и стабильности. VC9 версии требутся установить Microsoft 2008 C + + Runtime (x86) или Microsoft 2008 C + + Runtime (x64)

    -Не использовать VC9 версию с apache.org файлами.

    -VC9 версии Apache могут быть выбраны в Apache Lounge. Мы используем их для создания бинарных файлов Apache видами SAPI.**

    На моем хостинге сейчас подключен сервер Apache 1.3.* [s56, Windows 2008 R2], aux3

    Есть вариант перевести на Linux 2.6 с модулями Apache 1.3.*, Fast CGI, CGI

    Читать:
    Как вернуть сетку в excel

Related Posts