PHP
Adapted from Wikipedia · Discoverer experience
PHP is a general-purpose scripting language designed for web development. It was created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released to the public in 1995. Originally, PHP stood for Personal Home Page, but today it means PHP: Hypertext Preprocessor, a recursive backronym.
PHP code runs on a web server. When a server processes PHP, it uses a special program called an interpreter to turn the code into something like a web page. This allows PHP to create parts of websites dynamically, such as showing the current date or pulling information from a database.
Because PHP is free software and can work on many different types of computers, it has become one of the most popular languages for building websites. Many tools and systems make it easier to use PHP, helping developers create everything from simple pages to large online services.
History
The PHP language started in 1993 when Rasmus Lerdorf created some tools to manage his personal homepage using Common Gateway Interface programs. He made these tools work with HTML forms and databases, naming them "Personal Home Page/Forms Interpreter" or PHP/FI.
PHP/FI could build simple and dynamic web applications. It was first shared publicly in 1995 and grew quickly. Over time, more people joined to help develop PHP.
In 1997, Zeev Suraski and Andi Gutmans redesigned PHP, which led to PHP 3. They continued improving it, creating PHP 4 in 2000 and PHP 5 in 2004. Each new version added important features and made PHP more powerful.
Later versions, like PHP 7 and PHP 8, focused on making the language faster and easier to use. These updates helped PHP stay popular for building websites and web applications.
| Version | Release date | Supported until | |
|---|---|---|---|
| Unsupported: 1.0 | 8 June 1995 | ||
| Unsupported: 2.0 | 1 November 1997 | ||
| Unsupported: 3.0 | 6 June 1998 | 20 October 2000 | |
| Unsupported: 4.0 | 22 May 2000 | 23 June 2001 | |
| Unsupported: 4.1 | 10 December 2001 | 12 March 2002 | |
| Unsupported: 4.2 | 22 April 2002 | 6 September 2002 | |
| Unsupported: 4.3 | 27 December 2002 | 31 March 2005 | |
| Unsupported: 4.4 | 11 July 2005 | 7 August 2008 | |
| Unsupported: 5.0 | 13 July 2004 | 5 September 2005 | |
| Unsupported: 5.1 | 24 November 2005 | 24 August 2006 | |
| Unsupported: 5.2 | 2 November 2006 | 6 January 2011 | |
| Unsupported: 5.3 | 30 June 2009 | 14 August 2014 | |
| Unsupported: 5.4 | 1 March 2012 | 3 September 2015 | |
| Unsupported: 5.5 | 20 June 2013 | 10 July 2016 | |
| Unsupported: 5.6 | 28 August 2014 | 31 December 2018 | |
| 6.x | Not released | —N/a | |
| Unsupported: 7.0 | 3 December 2015 | 10 January 2019 | |
| Unsupported: 7.1 | 1 December 2016 | 1 December 2019 | |
| Unsupported: 7.2 | 30 November 2017 | 30 November 2020 | |
| Unsupported: 7.3 | 6 December 2018 | 6 December 2021 | |
| Unsupported: 7.4 | 28 November 2019 | 28 November 2022 | |
| Unsupported: 8.0 | 26 November 2020 | 26 November 2023 | |
| Unsupported: 8.1 | 25 November 2021 | 31 December 2025 | |
| Supported: 8.2 | 8 December 2022 | 31 December 2026 | |
| Supported: 8.3 | 23 November 2023 | 31 December 2027 | |
| Supported: 8.4 | 21 November 2024 | 31 December 2028 | |
| Latest version: 8.5 | 20 November 2025 | 31 December 2029 | |
Legend: Unsupported Supported Latest version Preview version Future version | |||
Mascot
The mascot of the PHP project is the elePHPant, a blue elephant with the PHP logo on its side, designed by Vincent Pontier in 1998. When you look at the PHP letters from the side, they form the shape of an elephant.
The elePHPant comes in different colors, especially as plush toys. Many versions of this mascot have been made over the years, but only those based on Vincent Pontier's original design are considered official. These elePHPants are collectable, and some rare ones are very hard to find.
Syntax
PHP is a language used to build websites. You can mix PHP code with HTML to create dynamic pages. PHP code is placed inside special tags, and only that code is processed by the PHP interpreter. Everything else is treated as normal content.
Variables in PHP start with a dollar sign ($). Unlike some other languages, you don’t need to specify what kind of data a variable will hold before using it. PHP can handle many types of data, including whole numbers, decimals, and text. It also has special types for true/false values and for handling resources like files or databases.
Implementations
The main version of PHP is called simply PHP, and it uses something called the Zend Engine to run PHP code. The Zend Engine changes PHP code into a special format so it can be used by computers.
To make PHP run faster, tools like Zend Opcache help by storing already-processed PHP code so it doesn’t need to be processed again each time. There are also other versions of PHP made by different groups. One example is HHVM, created by Facebook, which changes PHP code into another format to make it run even faster. Other tools like Parrot, PeachPie, Phalanger, and Quercus also try new ways to run PHP code quickly.
Licensing
PHP is free software released under the PHP License, which is similar to the 3-clause BSD license. Earlier versions of PHP had stricter rules, including limits on how the name "PHP" could be used in related products. These rules made older PHP licenses incompatible with other common software licenses.
Development and community
PHP works with many free and open-source libraries and has built-in tools to connect with servers and databases like PostgreSQL, MySQL, Microsoft SQL Server, and SQLite. Developers can add new features to PHP by writing extensions in the C programming language. These extensions can be added directly into PHP or loaded when needed.
PHP is mainly used for building websites, but it can also be used for other tasks, like controlling drones. There are community projects that help make creating these extensions easier. The PHP Group, which helps guide the language, includes several key developers who have contributed to PHP over the years.
The PHP Foundation
On 26 November 2021, the JetBrains blog announced the creation of The PHP Foundation, which will sponsor the design and development of PHP. The foundation hires "Core Developers" to work on the PHP language's core repository. Germany's Sovereign Tech Fund provided more than 200,000 Euros to support the PHP Foundation.
The response to the foundation has been largely positive, with commentators praising its role in ensuring the continued development of PHP and helping to stabilise the language's community and popularity.
Installation and configuration
PHP can be added to a web server in two main ways: as a module that works directly with the server, or as a separate program that the server calls when needed. Many popular web servers, like Apache HTTP Server and Microsoft IIS, support PHP modules. If a server doesn’t support PHP modules, PHP can still be used by running it as a separate program.
PHP also has special tools for running commands from the computer’s command line and can be used to create programs outside of a web server. There are many settings that can be adjusted to change how PHP works, usually found in a file called php.ini.
Use
PHP is a general-purpose scripting language that works very well for creating websites. It can run on many different types of computers and works with lots of databases. People often use PHP to make web pages change based on what the visitor does, like showing different news or pictures.
PHP is especially popular for building websites. Many big website tools, like WordPress and Drupal, use PHP. In fact, PHP is used by most websites that need a programming language to work behind the scenes. It’s free to use, and many people around the world help improve it all the time.
Security
PHP has had security issues over the years. In 2019, 11% of all listed computer problems were related to PHP. Some old PHP settings, like magic_quotes_gpc and register_globals, made websites easier to hack. These settings are no longer used in newer PHP versions.
PHP also has some tricks with numbers and text that can cause problems. For example, it might think two different things are the same when they are not, which can let hackers break into websites. Developers are advised to use special functions like hash_equals() to compare things safely.
Cryptographic security
PHP used to have functions for random numbers that were not very safe. Now, in version 8.1 and later, there is a better function called random_int() that is safer to use.
Long-term support
PHP gets regular updates to fix problems. Each small version gets updates for two years, and then only important security updates for another two years. After that, PHP stops getting updates unless special paid support is bought from companies like Zend.
Images
Related articles
This article is a child-friendly adaptation of the Wikipedia article on PHP, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.
Safekipedia