An introduction to PHP

by Gisle Hannemyr

This chapter ....

Table of contents

Introduction

PHP is a popular general-purpose scripting language that is especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. For the first 20 years, PHP had no written specification. I think it is safe to say that it will not win any design awards. However, in 2021, PHP is by far the main platform for the interactive websites. According to W3Techs, it has a 79 % share of the market for server-side programming languages. That means it is likely to stay in the site-builders toolschest for some time.

PHP versions

A brief History of PHP, up to PHP 5 (2004) is on php.net.

There was no PHP 6. For PHP 7, see Vilson Duka: Introduction To PHP 7.

Links to pages listing backward incompatible changes from PHP 7 and onwards:

The table below shows the PHP versions supported by various versions of Drupal core at the time of writing (2023-09-18):

You may also want to see: PHP.net: Supported Versions.

Drupal: PHP requirements
PHP versionDrupal coreRecommended
versionD9?D10?
5.5None--
5.6^7--
7.1^7, ^8--
7.2^7, ^8--
7.3^7, ^8, ^9No-
7.4^7.71, ^8, ^9No-
8.0^9Yes-
8.1^9.5, ^10YesYes
8.2^10-Yes

Sources: Drupal.org PHP requirements (D7) and PHP requirements (D8+).

The latest version of PHP 8.2, was released 2022-12-08. The default versions that ships with Ubuntu LTS are:

You may specify the minimum PHP version (see .info.yml example) like this:

php: 8.0

Below are some pointers to online materials about PHP.

Final word

You may also want to read SO: PHP errors explained.


Last update: 2023-09-18 [gh].