PHP
PHP is a general-purpose scripting language made for web development. It was created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The main version of PHP is now produced by the PHP Group. The name PHP was first short for "Personal Home Page," but today it stands for the recursive backronym "PHP: Hypertext Preprocessor."
PHP code is usually run on a web server by a PHP interpreter. This interpreter can work as a module, a daemon, or a Common Gateway Interface (CGI) program. When the code runs, it can create many kinds of data, such as HTML pages or binary image data. This result can make up all or part of an HTTP response, which is the reply a web server sends back to a visitor's browser. Tools such as web template systems, content management systems, and web frameworks can help build these responses. PHP can also be used for other tasks outside the web, although this is rare. PHP code can even be run directly from the command line.
The standard PHP interpreter is powered by the Zend Engine. It is free software, which means people can use and share it freely, and it is released under the PHP License. PHP has been adapted to work on many operating systems and platforms, so it can run on most web servers.
History
PHP did not start with a written formal specification or standard. The original implementation served as the de facto standard that other versions tried to follow. Rasmus Lerdorf first wrote Common Gateway Interface (CGI) programs to maintain his personal homepage. He extended them to work with HTML forms and databases, and called the result "Personal Home Page/Forms Interpreter", or PHP/FI. In 1997, Zeev Suraski and Andi Gutmans rewrote the core and formed the base of PHP 3, which changed the language's name to PHP: Hypertext Preprocessor. They then built the Zend Engine in 1999.
Over the following years, PHP grew through many new versions. PHP 5.0 was released in 2004 with a reworked approach to object-oriented programming. A project to add native Unicode support was abandoned in 2010. PHP 7 was developed in 2014 and 2015 with a focus on improving performance. PHP 8.0 was released on 26 November 2020 and added a JIT compiler, which can speed up some kinds of code. Security support for PHP 5.6 ended on 31 December 2018.
| 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 | |
| Preview version: 8.6 | 19 November 2026 | ||
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. Vincent Pontier designed it in 1998. The idea came from a noticing: "I suddenly noticed that the letters [PHP] were forming the shape of an elephant if viewed in a 'sideways angle [sic]."
The elePHPant is sometimes a different colour when it is made as a plush toy. Many versions of this physical mascot have been made over the years. Only the elePHPants based on Vincent Pontier's original design are considered official by the community. Some of these are collectable, and a few are extremely rare.
Syntax
A Hello, World! program is written as PHP code inside an HTML document. PHP only runs code within its delimiters. Text outside them is not processed by PHP, although it can still be affected by control structures written in PHP code. In XHTML and other XML documents, the short form creates correctly formed XML instructions. Variables are prefixed with a dollar symbol, and their type does not need to be set in advance. PHP 5 added type declarations that let functions require parameters to be objects of a certain class, arrays, interfaces or callback functions. Before PHP 7, these could not be used with simple types such as integers or strings. Variable names are case-sensitive. Both double-quoted and heredoc strings can include a variable's value. PHP treats newlines as whitespace, as in a free-form language, and statements end with a semicolon. PHP has three kinds of comments. Its keywords and syntax are similar to those of C, C++, C#, Java and Perl, so if conditions, for and while loops, and function returns look familiar to programmers who know those languages.
PHP is loosely typed. It stores whole numbers as signed integer values in a size that depends on the computer, similar to the C-language long type. Integers can be written in octal, hexadecimal or binary notation. Floating-point numbers can use scientific notation. PHP has a Boolean type, similar to those in Java and C++. Arrays can hold any kind of item, including other arrays, and PHP supports strings and hashes. Functions can be written by the developer and can be used as callbacks or in function tables. PHP also supports anonymous functions and closures, which can be stored in variables and passed as a parameter. Object-oriented programming, or object-oriented programming, was added in PHP 3 and improved in PHP 4. PHP 5 rewrote how objects are handled, so they are referenced by handle rather than by value types. It also added interfaces, abstract classes, final classes, constructors, destructors, and a standard exception handling model. Access to properties and methods is controlled with keywords such as public, private and protected, which affect inherited classes and the visibility of items.
Implementations
The original version of PHP, simply called PHP, is the only complete implementation. It is the most widely used and is powered by the Zend Engine. To tell it apart from other versions, it is sometimes unofficially called "Zend PHP." The Zend Engine compiles PHP source code on the fly into a format it can run, so it works as an interpreter. Zend PHP is also the "reference implementation" because PHP has no formal rulebook, so the way Zend PHP works defines how PHP works. Because PHP is complex, other versions find it hard to match it perfectly.
PHP runs each script one request at a time, and the Zend Engine is an interpreter, which can make it slow. To help, several tools have been made. An opcode cache saves a ready-to-run form of a PHP script in shared memory, so the computer does not have to parse and compile the code each time it runs. The Zend Opcache has been built into PHP since version 5.5. The Alternative PHP Cache (APC) is another widely used option and is available as a PECL extension. Zend PHP is still the most popular version, but several other versions exist. Some are compilers or support JIT compilation, which can make them faster but means they do not fully support all of PHP. Other versions include:
- HHVM (HipHop Virtual Machine), developed at Facebook and open source. It changes PHP code into a intermediate language and then into machine code while running, using a just-in-time compiler. It can be up to 6 times faster. Since version 7.2, Zend has been faster than HHVM, and HHVM 3.24 is the last version to officially support PHP.
- Parrot, a virtual machine built to run dynamic languages efficiently. The Pipp translator changes PHP code into the Parrot intermediate representation, which the virtual machine then runs.
- PeachPie, a compiler that changes PHP into Common Intermediate Language code for .NET. It is built on the Roslyn platform and is the successor of Phalanger.
- Phalanger, which compiles PHP into .NET Common Intermediate Language code. It came before PeachPie.
- Quercus, which compiles PHP into Java bytecode.
Licensing
PHP is free software released under the PHP License, which is equivalent to the 3-clause BSD license. Versions before 8.6 were released under a stricter license. Under that license, products built from PHP could not be called "PHP" or include "PHP" in their name without written permission. Instead, they could say they work with PHP, for example "Foo for PHP."
This rule about the name "PHP" made the PHP License incompatible with the GNU General Public License (GPL). The Zend License was also incompatible with it, because it had an advertising clause like the one in the original BSD license.
Development and community
See also: List of PHP software and tools
PHP comes with many free and open-source libraries built in or used in its files. It is made to work well on the Internet, with built-in tools for connecting to File Transfer Protocol (FTP) servers and many database systems, including PostgreSQL, MySQL, Microsoft SQL Server, and SQLite, which is a small database built into a program. It can also connect to LDAP servers. Many functions that C programmers already know, such as those in the stdio family, are available in standard PHP.
Developers can write extensions in C to add new features to PHP. Extensions can be built into PHP or loaded while it runs. Many add support for the Windows API, managing processes on Unix-like operating systems, multibyte text (Unicode), cURL, and popular compression formats. Others allow connecting to Internet Relay Chat (IRC), creating images and Adobe Flash content, using PHP Data Objects (PDO) to access databases, and even speech synthesis. The PHP Extension Community Library (PECL) is a collection of extensions. Most of the community works on web development, and some people use PHP for graphical applications (such as PHP-GTK, which has not been maintained for over a decade) or even drone control. Other projects, such as Zephir, let people write extensions in a high-level language that is then turned into PHP extensions, which makes development faster. By December 2018, the PHP Group had ten members, including Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Zeev Suraski, and Andrei Zmievski. Zend Technologies offers a PHP Certification for programmers who want to become certified PHP developers.
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 code. Roman Pronskiy, a member of the foundation's board, said that they aim to pay "market salaries" to developers. The response to the foundation has been largely positive. Germany's Sovereign Tech Fund gave more than 200,000 Euros to support the PHP Foundation. As of 2026, the foundation employed 13 full-time and part-time engineers, according to The Guardian.
Installation and configuration
There are two main ways to add PHP to a web server: as a built-in module, or as a CGI program. PHP has a direct module interface called server application programming interface (SAPI), which many web servers support, including Apache HTTP Server, Microsoft IIS, Caddy (through FrankenPHP) and iPlanet Web Server. If a web server has no module support, PHP can still work as a Common Gateway Interface (CGI) or FastCGI processor. For command-line scripting, PHP uses a command-line interface (CLI), which is mainly used to build shell applications. PHP can also be used to write desktop graphical user interface (GUI) applications.
When PHP is used in cloud environments, special kits called software development kits (SDKs) help use cloud features. For example, Amazon Web Services provides an SDK for PHP, and Microsoft Azure can be used with a Windows Azure SDK for PHP. PHP has many configuration options, which are stored in a file called php.ini. The place where this file is looked for depends on how PHP is being used.
Use
PHP is a general-purpose scripting language that is especially suited to server-side web development, where it generally runs on a web server. PHP code in a requested file is executed by the PHP runtime, usually to create dynamic web page content or dynamic images. It can also be used for command-line scripting and client-side graphical user interface (GUI) applications. PHP can run on most web servers, many operating systems and platforms, and work with many relational database management systems (RDBMS). Most web hosting providers support PHP, and it is available free of charge. The PHP Group provides the complete source code so users can build, customize, and extend it.
PHP was originally designed to create dynamic web pages, but it now focuses mainly on server-side scripting. It is similar to other languages that provide dynamic content from a web server, such as Python, Microsoft's ASP.NET, Sun Microsystems' JavaServer Pages, and [mod perl](/wiki/Mod_perl). Many software frameworks have been built for PHP to speed up rapid application development, including PRADO, CakePHP, Symfony, CodeIgniter, Laravel, Yii Framework, Phalcon, and Laminas, which offer features similar to other web frameworks. PHP is often used with the LAMP architecture, a popular way to run web applications, alongside Linux, Apache, and MySQL. Similar packages called WAMP and MAMP exist for Windows and macOS. PHP is also used by many Web content management systems, such as MediaWiki, WordPress, Joomla, and Drupal. PHP has received mixed reviews because it lacks support for multithreading at the core language level. In October 2026, researchers found security flaws in PHP that could let hackers run harmful code on vulnerable servers, and these flaws became known as PHP2Shell. PHP's developers released fixes for the flaws on October 21, 2026.

Quiz time!
5 questions about PHP
What is the mascot of the PHP project?
Pictures
Keep exploring
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.