Menu

Before you switch PHP versions on a WordPress site: checks, a staging clone, and a rollback that survives a failed upgrade
📰

Before you switch PHP versions on a WordPress site: checks, a staging clone, and a rollback that survives a failed upgrade

DEV Community: php·AumCreate·about 5 hours ago
#6FC7hxQr
#devto#dev#version#staging#example
Reading 0:00
15s threshold

The host panel gives you a dropdown of PHP versions. Changing it takes one click. Finding out whether the site still works takes a morning, and if it doesn't, you're doing it in front of customers.

Most of the prep work is finding out what is actually running, and making sure that undoing the switch restores data as well as files. Here is the sequence I'd run, in order.

Start with an inventory, including the parts that have no headers

cd /path/to/wordpress wp core version wp eval 'echo PHP_VERSION, " ", PHP_SAPI, PHP_EOL;' wp plugin list --fields = name,status,version --format = table wp theme list --fields = name,status,version --format = table wp plugin list --status = must-use --fields = name --format = csv ls -1 wp-content/ * .php 2>/dev/null

Enter fullscreen mode

Exit fullscreen mode

Save the list so you can diff against it after the switch:

{ wp plugin list --fields = name,status,version --format = csv wp theme list --fields = name,status,version --format = csv wp plugin list --status = must-use…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.