Running multiple PHP versions on the same server or development machine is never straightforward. One distro upgrade can break packages and turn your environment into a mess. For example, Ubuntu 20.04 ships with PHP 7.4, 22.04 comes with PHP 8.1, and 24.04 will use PHP 8.3. But what if you have projects that require both old and new PHP versions at the same time? That’s where PHPenv comes in. It’s an excellent tool for local development—and even for UAT servers.
To demonstrate how to use different PHP versions side by side, I’ll first install WordPress on Ubuntu 20.04 using Ansible. After that, I’ll set up PHPenv and switch to PHP 8.2.5 using pfm. The first part focuses on WordPress with Ansible, but if you want to skip straight to the PHPenv setup, feel free to jump ahead.
Continue reading “PHPEnv: Run Different PHP Versions Side by Side on Ubuntu”