Author Topic: Update default PHP version but keep old websites running the current version  (Read 3944 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
The default PHP version on my server is PHP 7.3 I want to update it to 8.0 or 8.1, but since I have lots of websites most of them are using the current default version I want to keep that websites with the current version. There are any way to do that automatically?

Some websites are already using a custom php version, that websites will be not affected by this, but the ones that don't set a custom php version I need to force to set version 7.3 before uptade the default php to 8.1

Offline
****
PHP-FPM is your answer
Google Hangouts:  rcschaff82@gmail.com

Offline
*

Offline
***
There are any way to do that automatically?

No.

PHP-FPM is your answer

Why?

Your first post shows that you know a bit about how these things works. That's why he gave you the short answer.

The long answer:

1. Install PHP 7.3 through PHP-FPM.
2. Go to Webserver Domain Conf and choose the domain(s) you want to stay with 7.3.
3. Select the appropriate Webserver configuration and then tell the panel to apply PHP-FPM 7.3 to those sites.
4. Double check everything is working right on those domains.
5. Now, upgrade your default PHP version to 8.x.

Now all websites will be using PHP 8.x except those domains you told the panel to keep using PHP-FPM 7.3 at point 3 above.
« Last Edit: February 10, 2022, 07:59:27 PM by iraqiboy90 »

Offline
*
There are any way to do that automatically?

No.

PHP-FPM is your answer

Why?

Your first post shows that you know a bit about how these things works. That's why he gave you the short answer.

The long answer:

1. Install PHP 7.3 through PHP-FPM.
2. Go to Webserver Domain Conf and choose the domain(s) you want to stay with 7.3.
3. Select the appropriate Webserver configuration and then tell the panel to apply PHP-FPM 7.3 to those sites.
4. Double check everything is working right on those domains.
5. Now, upgrade your default PHP version to 8.x.

Now all websites will be using PHP 8.x except those domains you told the panel to keep using PHP-FPM 7.3 at point 3 above.

Manually I know that I can create a custom configuration for each domain but do this for more than 200 domains, it's better for me buy a second server and keep the current one with this old php version.

All my websites use regular PHP running under Apache, I can't change it to php-fpm because it requires that I change the .htaccess in every website, lots of this websites are managed by my clients.


Offline
*
Hello

I am not expert and just able to fiddle into linux and cwp

I have CWP PRO on Almalinux 9 recent up to date installation as of sept 2024, I am using apache+nginx (i'd like to use the apache+nginx+varnish but I could not find a way to have working right... I'll investigate on that later on..)

Understanding the practical advantages I settled PHP-FPM.
As I wanted to be able to use some older software in the domains I will use in the PHP-FPM panel I installed also PHP7.4

I intuitively managed to settle my server to have PHP 8.3 as default, that was done into the "Webservers Main Conf" panel where I specified that:
Nginx default PHP-FPM version: 8.3
Apache default PHP-FPM version: 8.3

In the "Webservers Domain Conf" panel where one can select a username and go into the "Manage webservers Configuration" panel where can see the domains list for that user and click "view edit configuration" for a domain getting a panel similar to the one seen into the "Webservers Main Conf" I settled the "PHP-FPM Service Configuration" > PHP-FPM version to 8.3 (which I think does mean that the default PHP version for this domain is now settled to PHP 8.3)

Despite the settlings explained here above:
- in my server CWP dashboard in the bottom info panel on left side I read this: "PHP version: 7.4.33 |forced PHP-FPM:8.3|"
- in the domain control panel dashboard on the bottom of the right column where is a small info panel I read the same, PHP: 7.4.33

I do not understand this, my idea was to have php7.4 available just to be used in some domains or even some directories in a domain in order to use old software that can't use PHP 8X versions, I never meant to use PHP 7.4 for other purposes and while setting up I never indicated PHP 7.4 as default for anything, actually I did not even settled PHP 7.4 in use anywhere int he domain.

Therefore, why is PHP 7.4 mentioned in the dashboards as "in use", with PHP 8.3 forced in the main dashboard and as "default" in the domain dashboard if, in theory, is not used on both?

How can I check which version are really used in the server and in the domain?

Ty in advance for help and info.

Offline
**
To check which version of PHP is used by the website create a .php script with the following content:

Code: [Select]
<?php
phpinfo
();
?>

in the document root (home folder) of the website and then access it over:
http://domain.com/script.php
Remove the script after the test for security reasons.

Also, what do you get when you run:

Code: [Select]
php -vin the command prompt (shell) of your server ?


Offline
*
Hi, ty

Using the test php script on the domain I get what is expected, PHP 8.3 as is also possible to check into the cwp control panel of domain in the  CWP Settings > PHP Selector panel.

None the less anyway in the Left column of the domain control panel, in the small info widget at bottom of the column I read PHP: 7.4.33, which I think now that is the php version that the panel itself do use, in fact the domain control panel is served not by the domain webserver itself but by the main server itself on which is settled the hostname

I then used ssh to check using the php -v command on the main server accessible via the hostname, the one that serves the CWP panel(s) too, the result is that the PHP version used is the 7.4 as in fact is stated int he dashboards.

As far as I understand by theory would be good to use the PHP version that is "LTS" still receiving security updates and well known to be the most secure.

Therefore, what about the PHP 7.4?

Is it still OK to use PHP 7.4 for the main server?

Which would be the best PHP version to be used for the main server using CWP?

At this point due to my lack of knowledge I do not know if what does PHP-FPM has nothing to do with the PHP version used by the main server using the hostname, is maybe to be configured apart?

Was the PHP version to be used by the main server to be settled during the CWP installation process using the script options?

However, having the main server now using PHP 7.4, in case it would be better to use a more recent version for it, provided that now:

- I read on the CWP dashboard that PHP is 7.4 and PHP-FPM v 8.3 is "forced"
- that via the ssh PHP -v command check I see that PHP version used on the main server accessible via hostname or IP is the PHP7.4
- that in the "Webservers Main Conf" panel as I specified Nginx default PHP-FPM version: 8.3 and  Apache default PHP-FPM version: 8.3 are settled already

How can I change the PHP version used by the main webserver accessible via the hostname or server IP and at the same time not remove the PHP 7.4 version from PHP-FPM leaving it available to be used in some domains or folders into domains only?

Sorry for the many questions at once (I do not want to forget to investigate for each), and ty in advance for any info and help.

Offline
**
Quote
Therefore, what about the PHP 7.4?

Is it still OK to use PHP 7.4 for the main server?

Actually, PHP 7.4 is EOL:
https://www.php.net/supported-versions.php
If you want to change it then you can do it here:
CWP admin --> PHP Settings --> PHP Version Switcher.
On my optinion, PHP 8.1 or any higher version will be ok.

It will change the PHP version used by the main webserver too and leave PHP-FPM versions intact.

Offline
*
Thank you, I am going to take a snapshot, try and test

Offline
*
Re: Update default PHP version but keep old websites running the current version
« Reply #10 on: September 27, 2024, 12:34:33 AM »
OK

I did it and seems to work fine, upgraded to 8.2.23 (actual latest of the 8.2 branch, I thought being a bit conservative might be fine, so I did not opt for the 8.3 branch yet)

I also understood what fooled me into not finding the very easy proper solution using CWP GUI just as is...

The PHP-FPM method is used to have multiple PHP versions in such ways so to be able to easily maintain up to date and choose/switch at wish with a few clicks one of the many PHP versions for the domains' webservers in order to accommodate the various software needs. That is simply awesome!

When in CWP the PHP-FPM system is activated in the PHP Switcher panel appears a warning telling the following:

WARNING! This PHP versions are not active as you have forced PHP-FPM here!
You can use PHP-FPM selector per version configuration and modify WebServers for each domain/subdomain if you want to use a custom PHP-FPM version.


Somehow that warning did let me think that the PHP Switcher panel is not active and not to be used when PHP-FPM is in use!

That misunderstanding one can fall into is due to the very first sentence of the warning: "This PHP versions are not active as you have forced PHP-FPM here!"

That warning let one think that when PHP-FPM is active there is nothing to do in the PHP Switcher panel, also there is no note telling that the PHP switcher can be anyway used to change the main server PHP version even if PHP-FPM is active.
Furthermore nowhere is written that the main server PHP version cannot be changed via the PHP-FPM manager.

That first sentence in the warning message should be changed into somewhat more accurate that do not tell people, "leave this place as you can't use this until you use PHP-FPM" ^^

Maybe should be somewhat like this: "If PHP-FPM is active this PHP switcher can be used only to change the PHP version of the main server, cannot be used to change the PHP version of the webservers...".

So far so good, I cleared out an "enigma" ^^, to me looked too strange that could not be possible to setup different PHP versions for the main server using the CWP GUI itself, finally I know why I could not figure it out. This was a funny event :D ^^

Thank you for the very useful hint, very appreciated.

Offline
*****
Re: Update default PHP version but keep old websites running the current version
« Reply #11 on: September 30, 2024, 04:43:42 AM »
aha, glad you got that cleared up. yes it can be confusing -- but for many people start off with CGI PHP and change the version with the switcher. PHP-FPM is for the web server (web sites), so each once can have its own PHP version -- quite handy for sites that are still anchored via their CMS install to a certain PHP version.