WPCloudDeploy / wp-cloud-deploy

WPCloudDeploy is a WordPress plugin that allows you to easily deploy and manage your own dedicated high-performance WordPress servers and sites at any cloud server provider.
https://wpclouddeploy.com
Other
91 stars 42 forks source link

V5 Default PHP Version #67

Closed backpackingseries closed 1 year ago

backpackingseries commented 1 year ago

Hi,

After a deployed a new Linode server, I set the default PHP version to 8.1. Screenshot below

WPCD Default PHP on Server Screenshot from 2022-10-11 18-36-44

However, when I installed an app on that server, the app defaults to version 7.4

WPCD Default PHP on Apps Screenshot from 2022-10-11 18-37-55

Is this expected behaviour for apps to not inherit the PHP version from the server? If so, how to set PHP default version to 8.1 all across for new deployments?

Reference: https://wpclouddeploy.com/documentation/more/php-8-0-8-1-notes/

Kind regards,

osidney commented 1 year ago

I think this version of PHP is related to PHP CLI and not the site installation version in the panel.

osidney commented 1 year ago

Run on the server via SSH the php -v command and see if it will show the default version set on the tools screen.

backpackingseries commented 1 year ago

Thanks @osidney

I am trying to reconcile what I read here - https://wpclouddeploy.com/documentation/more/php-8-0-8-1-notes/ and the understanding now.

Does it mean that for WPCLI and other scripts, PHP 7.4 is supported on the server. Whereas PHP version 8.1 is supported for WordPress apps (set via the site screen)? Would that be the recommended config?

Kind regards,

elindydotcom commented 1 year ago

There are two locations where PHP is used and therefore each can be set a version independently.

There is a 'server' version - which, as osidney mentioned is the equivalent of running a php script from the server command line. This is what WP CLI uses.

You can set this version in the SERVER → TOOLS tab.

Then there is the version that each site uses (the php pool). You can set this version in the site PHP tab.

backpackingseries commented 1 year ago

Thank you @elindydotcom That helps.

Few questions, if you do not mind please:

  1. For now, if I want to be at the latest PHP versions, would these be PHP 7.4 on the server and PHP version 8.1 for WordPress apps?
  2. For now, is there a way for me to define a default PHP version for new WordPress apps to be 8.1?
  3. Lastly, is it possible to specify not to install certain PHP versions for new site deployments?

Kind regards,

elindydotcom commented 1 year ago
  1. PHP 8.1 is the latest PHP version we install. You can use it for both parts if you like - just make sure your themes and plugins are compatible with it.
  2. Not without modifying the bash scripts (and likely the plugin code to update the meta storing the php version for the site)
  3. Not without modifying the bash scripts. (Right now all php versions prior to 7.4 are disabled by default anyway)
backpackingseries commented 1 year ago

Thanks much. That just leaves me with one observation @

  1. PHP 8.1 is the latest PHP version we install. You can use it for both parts if you like - just make sure your themes and plugins are compatible with it.

There's this text string carried forward since the previous WPCD version - a scary warning to not use versions other than version 7.4.

WPCD Default PHP on Server Screenshot from 2022-10-11 18-36-44

I guess this can be dropped now?

Kind regards,

elindydotcom commented 1 year ago

Yup, that does have to be updated.

unakriti commented 1 year ago

Sorry, just noticed the following. Screenshot from NGINX server deployment

NGINX PHP Versions Screenshot from 2022-10-16 14-00-21

On servers, PHP versions prior to 7.4 are also installed. Can these be dropped from V5 server installer?

Kind regards,

elindydotcom commented 1 year ago

No. There are still thousands of sites out there that use these earlier versions. But, they are disabled by default - only version 7.4 and higher are automatically enabled.