wordpress_ynh icon indicating copy to clipboard operation
wordpress_ynh copied to clipboard

Feature request: Allow specifying PHP version

Open CodeShakingSheep opened this issue 2 years ago • 1 comments

Describe the feature request

Atm it's not clear to me which PHP version will be used when a WordPress app is installed. For 6.2ynh1 it was PHP 8.0 and for 6.2.2ynh1 it is PHP 8.2. Sometimes WP sites need to be run on older PHP versions e.g. for plugin compatibility. Therefore I would love to have an option "PHP version" when installing the WordPress app and in the config panel as well, so that it can be changed at a later time.

CodeShakingSheep avatar Aug 02 '23 17:08 CodeShakingSheep

Opened this issue: https://github.com/YunoHost-Apps/wordpress_ynh/pull/229

What works for me was the following steps, in SSH and as root:

  1. Run this command in order to make a manual backup (we can't rely on the automatic backup made before the upgrade due to the change of phpversion config value): yunohost backup create -n wordpress_before_specify_phpversion --apps wordpress
  2. Change the php version, like follow (adapt the value to whatever version you want): yunohost app setting wordpress phpversion -v 8.1
  3. Upgrade wordpress so it uses the specified version: yunohost app upgrade wordpress -u https://github.com/fflorent/wordpress_ynh/tree/specify-php-version --force --no-safety-backup (or without the -u https://github.com/fflorent/wordpress_ynh/tree/specify-php-version if the patch is merged)
  4. Remove former dependencies (which were for the previous php version): apt autoremove
  5. Remove the pool file (assuming you were previously in php 8.2 and have downgraded to 8.1): rm /etc/php/8.2/fpm/pool.d/wordpress.conf
  6. Reload the previous php fpm service: systemctl restart php8.2-fpm

In case of error:

  1. yunohost app remove wordpress
  2. yunohost backup restore wordpress_before_specify_phpversion --apps

fflorent avatar Oct 07 '23 19:10 fflorent