Upgrading PHP is crucial for ensuring optimal performance, security, and compatibility for websites built on content management systems (CMS) like Drupal. With each new PHP version, improvements are introduced that boost speed, fix vulnerabilities, and enhance compatibility with newer modules and libraries. However, these upgrades also bring challenges, such as the need to test compatibility with existing modules, themes, and custom code.

This guide outlines the overall process for PHP upgrades on the Salsa Digital platform, focusing on how customers and developers should work together to ensure a smooth transition. The principles described are especially relevant for Drupal sites, as they often involve complex module dependencies and custom code that require careful attention during the upgrade process.

Core Principles of PHP Upgrades

  1. Platform as a Service (PaaS) Approach: Salsa Digital’s hosting platform provides a PaaS infrastructure, bundling the PHP version into the application codebase. PHP updates are part of the project codebase and should be handled as part of broader application changes.
  2. Compatibility Testing is Essential: Upgrading PHP requires comprehensive testing to ensure website functionality is maintained. Websites, especially those built on CMS platforms like Drupal, may need adjustments or compatibility fixes to modules, themes, and custom code during PHP updates.
  3. Customer Responsibility: Customers are responsible for testing their applications after PHP updates. Salsa Digital offers professional services to help ensure compatibility, but the final responsibility for testing falls on the customer.
  4. Staying Updated is Crucial: Customers are required to stay on the latest PHP version supported by Salsa Digital to ensure ongoing security and functionality.

PHP Version Lifecycle

PHP versions are released on an annual cycle, with each version supported for three years—two years of active support and one year of security fixes. After this period, a version reaches End of Life (EOL) and is no longer supported.

  • Active Support: The version receives regular updates, including feature additions and bug fixes.
  • Security Support: Only security-related issues are patched.
  • End of Life (EOL): No further updates are provided, increasing the risk of security vulnerabilities.

Customers should refer to the official PHP Supported Versions page for the current support timeline.

The PHP Upgrade Process: Best Practices

1. Planning the Upgrade Cycle

Salsa Digital recommends beginning the PHP upgrade cycle well in advance to allow time for testing and adjustments.

  • Notify Customers: The initial notification should be sent 6 months before the PHP version reaches the end of Active Support. This provides ample time for customers to plan and prepare for the upgrade.
  • Prepare Environments: At least 3 months before the upgrade, Salsa Digital will prepare test environments for all customers. This includes updating PHP to the target version and notifying customers to begin their testing process.
  • Final Switch: At least 2 weeks before the end of Active Support, all production sites will be switched to the new PHP version.

2. Detailed Timeline

  • 6 Months Before the end of Active Support: Notify customers about the upcoming PHP upgrade. Provide an overview of the upgrade process, timeline, and the importance of maintaining an up-to-date PHP version.
  • 4 Months Before the end of Active Support: Send a second notification to customers who haven't responded, stressing the upcoming deadline. Reiterate the importance of testing and offer support for any issues.
  • 3 Months Before the end of Active Support: Prepare test environments for all customers. Upgrade the PHP version in these environments and invite customers to test their websites thoroughly.
  • 2 Weeks Before the end of Active Support: Finalise the PHP upgrade by switching all production sites to the new version.

Why PHP Upgrades Require Thorough Testing

Upgrading PHP can impact the functionality of your CMS, especially if it relies on older modules or custom code. For Drupal, every PHP version introduces new features, deprecations, and stricter error handling, all of which can affect the CMS's operation.

PHP and CMS Compatibility: Each CMS has specific PHP requirements. For Drupal 10.2+, PHP 8.2 or higher is required. Refer to the Drupal PHP Requirements for more details.

Module and Theme Compatibility: While Drupal core may be compatible with a new PHP version, some contributed or custom modules might not be. In some cases, these modules will need to be updated or even replaced if the maintainers no longer provide support.

Common Challenges During PHP Upgrades

  • Deprecated Functions: PHP 8.2+ introduces deprecations for several functions that may be in use by older Drupal modules or themes.
  • Stricter Type Checking: Newer PHP versions enforce stricter type checks, which may cause errors if your site’s code isn’t up to date.
  • Custom Code Compatibility: Custom themes or modules developed in-house may need to be adjusted to ensure compatibility with the latest PHP version.

How Salsa Digital Ensures a Smooth PHP Upgrade

  • Preparation and Testing: Before upgrading production environments, Salsa Digital creates test environments for each customer. In these environments, the new PHP version is implemented, and customers are invited to test their site functionality.
  • Automated Testing: Salsa Digital uses automated testing tools such as PHPUnit and Behat to ensure compatibility with the new PHP version. We strongly recommend that customers integrate automated testing into their own development workflow to catch potential issues early.
  • Collaboration with Customers: Customers are expected to conduct thorough testing and provide feedback. The Salsa Digital team will review any issues reported during testing and work with the customer to resolve them. Any problems unrelated to the PHP upgrade (e.g., pre-existing bugs) should be addressed in a separate support ticket.

Why Skipping Multiple PHP Versions is Not Recommended

Skipping multiple PHP versions at once increases the risk of compatibility issues, particularly for websites using a wide variety of modules or custom code. For example, while it may be tempting to upgrade from PHP 7.4 directly to 8.2 or 8.3, certain modules may not be compatible with such a jump.

We recommend upgrading incrementally to minimize risk and allow more manageable testing. Each version update should include:

  • Full testing of website functionality
  • Thorough review of custom and contributed modules
  • Validation against automated test cases

Why Staying Updated Matters

Keeping PHP up to date offers several key benefits:

  • Improved Performance: Newer PHP versions come with significant performance improvements. Websites running on older versions may experience slower load times and reduced user engagement.
  • Enhanced Security: Outdated PHP versions are vulnerable to security threats. Once a PHP version reaches EOL, it no longer receives security patches, making your site susceptible to attacks.
  • Future-Proofing: Upgrading ensures compatibility with the latest CMS features and modules. As PHP evolves, so do the modules and libraries that power your website. Staying up to date reduces the risk of encountering compatibility issues when adding new functionality.

Conclusion: Collaborate for Success

PHP upgrades are an essential part of website maintenance, especially for Drupal sites with complex dependencies. By collaborating with Salsa Digital and following the recommended upgrade process, customers can ensure their websites remain secure, high-performing, and future-proof. Engaging early, performing thorough testing, and addressing issues proactively will lead to a successful upgrade experience.

For further assistance, contact Salsa Digital support to plan your PHP upgrade and ensure your Drupal website is ready for the future.

PHP Version Example Image