📜 ⬆️ ⬇️

Select PHP version for a specific CMS and do not cry

“I told you - they flew, but they didn’t run!”
“Come on, ostrich, go! We work, we work! ”



PHP is now one of the most popular programming languages ​​used to create websites. On shared linux web hosting in Russia with the choice of the PHP version is not entirely smooth, although there are exceptions to this rule.
Why is version selection necessary? Interesting? Welcome under the cut!

Consider the system requirements of the most common CMS on the Russian market - WordPress , Bitrix , Drupal and Joomla for PHP versions (we will not talk about the modules, this is a topic for a separate article):
list


But what comes out of the box in the most common distributions, which are installed at the hosts:
list
  • CentOS :
    • 6 - PHP 5.3
    • 7 - PHP 5.4

  • Debian :
    • 7 - PHP 5.4
    • 8 - PHP 5.6

  • Ubuntu :
    • 13 - PHP 5.4
    • 14 - PHP 5.5


We use CloudLinux , which corresponds to CentOS 6.7 in terms of package base. The “out of the box” situation is not bright - the PHP versions are very old.
And those clients whose site has been created for a long time and CMS has not been updated (and there are many of them coming to us from other hosting sites) usually want exactly the opposite - older versions of PHP due to the fact that their CMS has compatibility problems.
So there are two ways out: either collect from the source itself, or install from third-party repositories, which is not always possible.

What to do, how to be:

')
There is an alternative and we use it in our work: CloudLinux + CageFS + PHP Selector ! My colleague told about the first two components in a recent article .
These three components allow us to do the following:

To obtain this functionality, we had to test and then implement the following:

How does all this happen in a real environment? This can be done from LC:

Additionally, you can enable modules on the WEB service:
look



I will dwell a bit on the agent that interacts between the LC and the system where the hosting is deployed. The agent (written in python) is a service with a documented api that allows you to interact with CloudLinux. as an orchestrator. With regards to PHP - the agent allows you to change the version and settings for a specific client. When creating a new service (user), the agent uses the predefined settings, which can later be changed to custom ones.

If it is interesting to find out how it all works in more detail, I am waiting for comments on the most interesting points.

If you see any errors in the article - please write about it in PM.

Source: https://habr.com/ru/post/274023/


All Articles