Should I upgrade from PHP v.7.3 or v.7.4 to PHP v.8.1 or higher?

August 28, 2023

Ross Ross Gerring

PHP, which originally stood for “Personal Home Page” but now stands for “PHP: Hypertext Preprocessor,” is a server-side scripting language primarily used for web development. It can be embedded within HTML and is also commonly used for backend data manipulation, user authentication, and various other web application tasks.

PHP v.8.1 was released on 25 Nov 2021, and is security-supported until 25 Nov 2024
PHP v.8.2 was released on 8 Dec 2022, and is security-supported until 8 Dec 2025
PHP v.8.3 is not expected to be made available for production use (i.e. ‘general release’) until 23 Nov 2023.

PHP supported versions as at Aug 2023
source: https://www.php.net/supported-versions.php

Brief History

PHP was initially developed by Rasmus Lerdorf in 1994 as a set of Perl scripts for tracking visits to his online resume. Over time, it evolved into a tool to build dynamic web pages. Two Israeli developers, Zeev Suraski and Andi Gutmans, later revamped the core of PHP, launching PHP 3 in 1997 and subsequently PHP 4. This formed the foundation for PHP as we know it today. PHP 5 was released in 2004 and included new features like improved support for object-oriented programming. PHP 7, released in 2015, brought in significant performance improvements. PHP 8, the latest major version as of my last update, came out in November 2020 and included new features and optimizations.

Commercial Company or Community-Supported?

PHP is an open-source language, meaning that it’s free to use and modify. There isn’t a single commercial company behind it. Instead, it’s developed and maintained by a vibrant community of volunteers and contributors. Some companies offer commercial support, and various web development agencies and consulting firms, specialize in PHP, but the language itself is not owned by a commercial entity.

Which popular CMS (Content Management Systems) are powered by PHP?

  1. WordPress: This is the big oneā€”over 40% of all websites are powered by WordPress. It’s extremely user-friendly, highly customizable through plugins and themes, and has a massive community.
  2. Joomla: Another popular choice, Joomla offers more out-of-the-box features than WordPress but is generally considered to be a bit more complex to use.
  3. Drupal: Known for its robustness and scalability, Drupal is often chosen for more complex, enterprise-level websites. It has a steeper learning curve but offers more flexibility for custom development.
  4. Magento: Specialized for e-commerce, Magento offers a high degree of customization and scalability. The learning curve is steep, but it’s powerful for large e-commerce sites.
  5. Craft CMS: Gaining in popularity, Craft CMS offers a clean and intuitive backend with a focus on a flexible content structure. It’s a good fit for custom, design-first projects.
  6. PrestaShop: Another PHP-based e-commerce platform, PrestaShop is easier to use than Magento but still offers a good range of functionalities.
  7. OpenCart: A lightweight, simple-to-use e-commerce platform that’s also open-source. It’s less feature-rich than Magento but can be a good starting point for small to medium e-commerce businesses.
  8. ExpressionEngine: This is a flexible, feature-rich system that offers a lot of the “bells and whistles” but can be a bit overwhelming for newcomers.
  9. Concrete5: Known for its user-friendly interface, it allows in-context editing, meaning you can edit content directly on the page as you browse, rather than from a separate backend.

Which popular frameworks are built with PHP?

Frameworks are software packages that are built using scripting languages like PHP. Frameworks provide a blueprint, additional tools, and a set of best practices for building web applications more efficiently and maintainably.

  1. Laravel: Known for its elegant syntax and wide array of features, Laravel simplifies tasks like routing, caching, and authentication. It’s one of the most popular PHP frameworks and is often chosen for its developer-friendly tools.
  2. Symfony: Highly flexible and used by many large enterprises, Symfony components are also used by other systems like Laravel. It’s well-suited for large-scale or complex enterprise-level projects.
  3. Zend Framework: Now called Laminas Project, it is an object-oriented framework that uses features like namespaces and late static binding in PHP. It’s robust but can be complex and heavy for small projects.
  4. CodeIgniter: Known for its small footprint and excellent performance, CodeIgniter is an ideal choice for developers who want to build lightweight applications quickly.
  5. Yii: Extremely efficient and packed with features like caching, authentication, and role-based access control, Yii is particularly well-suited for high-traffic applications like portals, forums, and e-commerce websites.
  6. Phalcon: Written in C and C++, it’s delivered as a C extension for PHP, making it one of the fastest PHP frameworks available. However, its architecture can make it more challenging to get started with.
  7. CakePHP: One of the older frameworks, it has evolved considerably over the years and is still widely used. It follows the model-view-controller (MVC) approach and has built-in features for things like database access, caching, and authentication.
  8. Slim: As the name suggests, Slim is a lightweight micro-framework useful for small to medium web apps and APIs. It offers essential tools to handle routing and HTTP caching but leaves other functionalities for developers to add as they see fit.
  9. FuelPHP: This is a flexible, modular, and extendable framework that also follows the MVC pattern but adds its variation known as Hierarchical-Model-View-Controller (HMVC).

Should I upgrade the PHP version used by my website from 7.x to 8.x?

The simplistic answer is “yes”, but there are many things to consider first.

Before a PHP upgrade is attempted, it’s recommended that the software that powers your website or application (e.g. WordPress, Drupal, Laravel, etc.) is fully patched to the latest available production-quality versions. This applies to both the core software, and all plugins/modules.

After the PHP upgrade is complete, new opportunities might be available to further upgrade your website or application software.

Pros:

  1. Performance: PHP 8.x generally offers better performance over PHP 7.x. The Just-In-Time (JIT) compiler can make your website faster.
  2. New Features: PHP 8.x brings in several new language features like named arguments, attributes, and union types which can make your code cleaner and more efficient.
  3. Security: PHP 8.x will receive security updates for a longer period compared to PHP 7.x, which is crucial for maintaining a secure web application.
  4. Better Error Handling: Improved type errors and other error messages can help in debugging and maintaining the code.
  5. Library & Framework Compatibility: As time goes by, more libraries and frameworks will stop supporting PHP 7.x, making PHP 8.x a better long-term choice.

Cons:

  1. Compatibility: Your existing code, plugins, or third-party libraries might not be compatible with PHP 8.x, necessitating time-consuming refactoring.
  2. Testing Overhead: Given that not all features and functionalities would work the same way in PHP 8.x, extensive testing is needed to ensure everything works as expected.
  3. Deployment Time: The upgrade isn’t a simple flick of a switch; it will require time, effort, and potentially some downtime.
  4. Potential Bugs: As with any new version, there may be undiscovered bugs or issues that could affect your application.

Risks:

  1. Broken Functionality: Without proper testing, upgrading directly could lead to parts of your website breaking.
  2. Resource Consumption: Depending on your existing setup and architecture, the new features or changes in PHP 8.x may consume more resources, at least initially.

Benefits:

  1. Future-proofing: Upgrading will make your website more sustainable in the long run, especially if PHP 7.x support dwindles.
  2. Competitive Edge: Utilizing the new features can make your web application more efficient, secure, and possibly offer a better user experience, giving you an edge over competitors who lag behind in technology.

Itomic are experts with PHP, WordPress, Drupal and Laravel. Please do contact us for assistance upgrading your website or application to the latest recommended version.