Introduction
Managing multiple PHP versions is a common requirement for developers and server administrators, especially when hosting applications with different compatibility requirements. While web applications may run on specific PHP versions, command-line tasks such as Composer installs, Laravel Artisan commands, WordPress WP-CLI operations, and cron jobs often depend on the server’s PHP CLI version. RunCloud simplifies PHP version management by allowing users to switch PHP CLI versions with just a few clicks. In this guide, we’ll walk you through changing the PHP CLI version on your RunCloud server and verifying the update.
Understanding PHP Versions in RunCloud
RunCloud supports multiple PHP versions tailored to various Ubuntu distributions. The available versions are denoted as php[VERSION]rc, where [VERSION] corresponds to PHP versions like 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, and 8.4. For instance, php72rc refers to PHP 7.2.
Prerequisites
- Access to the RunCloud dashboard with appropriate permissions.
- SSH access to your server.
Change the PHP CLI Version
- Navigate to PHP Settings:
- In the “PHP Versions” section, locate the “PHP CLI Version” dropdown.
2. Select Desired PHP Version:
- Choose your preferred PHP version from the dropdown list.
3. Apply Changes:
- Click “Update PHP CLI Version” to apply the changes.
4. To verify, you can run the command below from the server via SSH
- php -v
Why Change the PHP CLI Version?
Different applications and development tools often require specific PHP versions to function correctly. While your websites may be configured to use a particular PHP version, command-line operations rely on the server’s active PHP CLI version.
You may need to change the PHP CLI version when:
- Running Composer with dependencies that require a specific PHP version.
- Executing Laravel Artisan commands or Symfony console commands.
- Managing WordPress sites using WP-CLI.
- Testing applications across different PHP environments.
- Ensuring compatibility after upgrading or migrating applications.
Conclusion
Switching PHP CLI versions in RunCloud is straightforward and helps ensure compatibility across your applications, development tools, and automated tasks. Whether you’re managing multiple projects or upgrading to a newer PHP release, RunCloud makes it easy to configure and maintain the correct PHP environment. After updating the CLI version, always verify the change using the command line to ensure your applications and scripts are running with the intended PHP version.

