PHP is a
general-purpose scripting language
A scripting language or script language is a programming language
A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming language ...
geared towards
web development
Web development is the work involved in developing a Web site, website for the Internet (World Wide Web) or an intranet (a private network). Web development can range from developing a simple single Static Web page, static page of plain text to co ...
. It was originally created by Danish-Canadian
programmer
A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software
Software is a collection of Instruction (computer science) ...

Rasmus Lerdorf
Rasmus Lerdorf (born 22 November 1968) is a Danish-Canadian programmer
A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates comput ...

in 1994.
The PHP
reference implementation
In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation of ...
is now produced by The PHP Group.
PHP originally stood for ''Personal Home Page'',
but it now stands for the
recursive initialism ''PHP: Hypertext Preprocessor''.
PHP code is usually processed on a
web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, com ...
by a PHP
interpreter implemented as a
module
Module, modular and modularity may refer to the concept of modularity. They may also refer to:
Computing and engineering
* Modular design, the engineering discipline of designing complex devices using separately designed sub-components
* Modula ...
, a
daemon
Daemon is the Latin word for the Ancient Greek daimon (δαίμων: "god", "godlike", "power", "fate"), which originally referred to a lesser deity or guiding spirit such as the daemons of ancient Greek religion and Greek mythology, mythology a ...
or as a
Common Gateway Interface
In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program, typically to process user requests.
Such programs are often written in a scripting language and are commonly refe ...
(CGI) executable. On a web server, the result of the
interpreted and executed PHP code which may be any type of data, such as generated
HTML
The HyperText Markup Language, or HTML is the standard markup language
In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntactically distinguishable from the ...

or
binary
Binary may refer to:
Science and technology
Mathematics
* Binary number
In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...
image data would form the whole or part of an
HTTP
The Hypertext Transfer Protocol (HTTP) is an application layer
An application layer is an abstraction layer that specifies the shared communications protocols and Interface (computing), interface methods used by Host (network), hosts in a co ...
response. Various
web template system
A web template system in web publishing lets web designers and developers work with ''web templates'' to automatically generate custom web page
A web page (or webpage) is a hypertext
File:Douglas Engelbart in 2008.jpg, Douglas Engelbar ...
s, web
content management system
A content management system (CMS) is a computer software used to manage the creation and modification of digital content (content management).''Managing Enterprise Content: A Unified Content Strategy''. Ann Rockley, Pamela Kostur, Steve Manning. Ne ...
s, and
web framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
s exist which can be employed to orchestrate or facilitate the generation of that response. Additionally, PHP can be used for many programming tasks outside the web context, such as standalone
graphical applications and
robotic
Robotics is an interdisciplinarity, interdisciplinary field that integrates computer science and engineering. Robotics involves design, construction, operation, and use of robots. The goal of robotics is to design machines that can help and assi ...

control. PHP code can also be directly executed from the
command line
A command-line interface (CLI) processes command (computing), commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor. Operating systems ...
.
The standard PHP interpreter, powered by the
Zend Engine
The Zend Engine is a compiler and runtime system , runtime environment for the PHP scripting language and consists of the Zend Virtual Machine, which is composed of the Zend Compiler and the Zend Executor, that compiles and executes the PHP code ...
, is
free software
Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty
...
released under the
PHP License
The ''PHP License'' is the software license under which the PHP scripting language is released. The PHP License is designed to encourage widespread adoption of the source code. Redistribution is permitted in source code, source or binary file, b ...
. PHP has been widely ported and can be deployed on most web servers on a variety of
operating system
An operating system (OS) is system software
System software is software designed to provide a platform for other software. Examples of system software include operating systems like macOS
macOS (; previously Mac OS X and later ...

s and
platforms.
The PHP language evolved without a written
formal specification
In computer science, formal specifications are mathematically based techniques whose purpose are to help with the implementation of systems and software. They are used to describe a system, to analyze its behavior, and to aid in its design by veri ...
or standard until 2014, with the original implementation acting as the ''
de facto
''De facto'' ( ; , "in fact") describes practices that exist in reality, even though they are not officially recognized by laws. It is commonly used to refer to what happens in practice, in contrast with ''de jure'' ("by law"), which refers to th ...
'' standard which other implementations aimed to follow. Since 2014, work has gone on to create a formal PHP specification.
W3Techs reports that, , "PHP is used by 79.2% of all the websites whose server-side programming language we know." PHP version 7.4 is the most used version. Support for version 7.3 was dropped on 6 December 2021.
History
Early history
PHP development began in 1994 when
Rasmus Lerdorf
Rasmus Lerdorf (born 22 November 1968) is a Danish-Canadian programmer
A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates comput ...

wrote several
Common Gateway Interface
In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program, typically to process user requests.
Such programs are often written in a scripting language and are commonly refe ...
(CGI) programs in
C,
which he used to maintain his
personal homepage
Personal web pages are world wide web web page, pages created by an individual to contain content of a personal nature rather than content pertaining to a company, organization or institution. Personal web pages are primarily used for informative ...
. He extended them to work with
web form
A webform, web form or HTML form on a web page allows a user to enter data that is sent to a server for processing. Forms can resemble paper
Paper is a thin sheet material produced by mechanically and/or chemically processing cellulose fibres ...
s and to communicate with
database
In computing, a database is an organized collection of Data (computing), data stored and accessed electronically from a computer system. Where databases are more complex they are often developed using formal #Design and modeling, design and mode ...

s, and called this implementation "Personal Home Page/Forms Interpreter" or PHP/FI.
PHP/FI could be used to build simple,
dynamic web applications. To accelerate
bug reporting and improve the code, Lerdorf initially announced the release of PHP/FI as "Personal Home Page Tools (PHP Tools) version 1.0" on the
Usenet
Usenet () is a worldwide distributed discussion system available on computers. It was developed from the general-purpose Unix-to-Unix Copy (UUCP) dial-up
Dial-up Internet access is a form of Internet access
Internet access is the ability of ...
discussion group ''comp.infosystems.www.authoring.cgi'' on June 8, 1995.
This release already had the basic functionality that PHP has today. This included
Perl-like variables, form handling, and the ability to embed
HTML
The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language
In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

. The
syntax
In linguistics
Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study of language. Linguistics encompasses the analysis of every aspect of language, as well as the ...

resembled that of
Perl
Perl is a family of two high-level
High-level and low-level, as technical terms, are used to classify, describe and point to specific Objective (goal), goals of a systematic operation; and are applied in a wide range of contexts, such as, for ...
, but was simpler, more limited and less consistent.
An example of the early PHP
syntax
In linguistics
Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study of language. Linguistics encompasses the analysis of every aspect of language, as well as the ...
:
Hey, you are using Netscape!
Sorry, that record does not exist
Welcome !
You have credits left in your account.
Early PHP was not intended to be a new
programming language
A programming language is a formal language
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calcu ...
, and grew organically, with Lerdorf noting in retrospect: "I don't know how to stop it, there was never any intent to write a programming language
..I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."
A development team began to form and, after months of work and
beta
Beta (, ; uppercase , lowercase , or ; grc, βῆτα, bē̂ta or ell, βήτα, víta) is the second letter of the . In the system of Greek numerals it has a value of 2. In , beta represented the . In , it represents the (while in foreig ...
testing, officially released PHP/FI 2 in November 1997.
The fact that PHP was not originally designed, but instead was developed organically has led to inconsistent naming of functions and inconsistent ordering of their parameters. In some cases, the function names were chosen to match the lower-level libraries which PHP was "wrapping", while in some very early versions of PHP the length of the function names was used internally as a
hash function
A hash function is any function
Function or functionality may refer to:
Computing
* Function key
A function key is a key on a computer
A computer is a machine that can be programmed to carry out sequences of arithmetic or logical ...

, so names were chosen to improve the distribution of
hash values.
PHP 3 and 4
Zeev Suraski
Suraski at a Toronto conference in 2010
Zeev Suraski ( he, זאב סורסקי ) is an Israel
Israel (; he, יִשְׂרָאֵל; ar, إِسْرَائِيل), officially known as the State of Israel ( he, מְדִינַת יִשְׂר ...

and
Andi Gutmans
Andi (Andrei) Gutmans is a programmer
A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software
Software is a col ...
rewrote the
parser
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a of , either in , or s, conforming to the rules of a . The term ''parsing'' comes from Latin ''pars'' (''orationis''), meaning .
The term has slightly different meani ...

in 1997 and formed the base of PHP 3, changing the language's name to the
recursive acronym
A recursive acronym is an acronym that recursion, refers to itself. The term was first used in print in 1979 in Douglas Hofstadter's book ''Gödel, Escher, Bach, Gödel, Escher, Bach: An Eternal Golden Braid'', in which Hofstadter invents the acron ...
''PHP: Hypertext Preprocessor''.
Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. Suraski and Gutmans then started a new
rewrite of PHP's core, producing the
Zend Engine
The Zend Engine is a compiler and runtime system , runtime environment for the PHP scripting language and consists of the Zend Virtual Machine, which is composed of the Zend Compiler and the Zend Executor, that compiles and executes the PHP code ...
in 1999. They also founded
Zend Technologies
Zend, formerly Zend Technologies, is a Minneapolis, Minnesota-based software company owned by software developer Perforce. The company's products, which include Zend Studio, assist software developers with developing, deploying and managing PHP-bas ...
in
Ramat Gan
Ramat Gan ( he, or ) is a city in the Tel Aviv District of Israel, located east of the municipality of Tel Aviv and part of the Gush Dan, Tel Aviv metropolitan area. It is home to one of the world's major diamond exchanges, and many high-tech in ...
,
Israel
Israel (; he, יִשְׂרָאֵל, translit=Yīsrāʾēl; ar, إِسْرَائِيل, translit=ʾIsrāʾīl), officially the State of Israel ( he, מְדִינַת יִשְׂרָאֵל, label=none, translit=Medīnat Yīsrāʾēl; ), is a ...

.
On 22 May 2000, PHP 4, powered by the Zend Engine 1.0, was released.
By August 2008, this branch had reached version 4.4.9. PHP 4 is now no longer under development and nor are any security updates planned to be released.
PHP 5
On 1 July 2004, PHP 5 was released, powered by the new Zend Engine II.
PHP 5 included new features such as improved support for
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm
Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms.
Some paradigms are concerned mai ...
, the PHP Data Objects (PDO) extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. In 2008, PHP 5 became the only stable version under development.
Late static binding had been missing from previous versions of PHP, and was added in version 5.3.
Many high-profile open-source projects ceased to support PHP 4 in new code from February 5, 2008, because of the GoPHP5 initiative,
provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.
Over time, PHP interpreters became available on most existing
32-bit
32-bit microcomputer
A microcomputer is a small, relatively inexpensive computer with a microprocessor as its central processing unit (CPU). It includes a microprocessor, Computer memory, memory and minimal input/output (I/O) circuitry mount ...
and
64-bit
In computer architecture, 64-bit Integer (computer science), integers, Memory address, memory addresses, or other Data#Uses%20of%20data%20in%20computing, data units are those that are 64 bits (8 Octet (computing), octets) wide. Also, 64-bit cent ...
operating systems, either by building them from the PHP source code, or by using pre-built binaries. For PHP versions 5.3 and 5.4, the only available
Microsoft Windows
Microsoft Windows, commonly referred to as Windows, is a group of several proprietary
{{Short pages monitor
of all PHP websites using version 5.6 or older.
Version 5 is still used by 24.5% of all the websites (September 2021). It is highly recommended to migrate to PHP version 7 or 8 and use random_int() instead of rand() or mt_rand(). There are two attacks that can be performed over PHP entropy sources: "Seed Attack" and "State recovery attack". With current GPU technologies an attacker can perform up to 2^30 MD5 calculations per second with a $250 GPU, while with an additional $500 can reach up to 2^32 calculations. In combination with a "birthday attack" this can lead to a serious security vulnerabilities.
See also
* Comparison of programming languages
* Comparison of web frameworks
* List of AMP packages
* List of PHP accelerators
* List of PHP editors
* PEAR (PHP Extension and Application Repository)
* PHP accelerator
* Template processor
* XAMPP (Free and open-source cross-platform web server solution stack package)
* Zend Server
References
Further reading
*
*
External links
*
{{Authority control
PHP,
1995 software
Articles with example PHP code
Class-based programming languages
Cross-platform software
Dynamic programming languages
Dynamically typed programming languages
Filename extensions
Free compilers and interpreters
High-level programming languages
Internet terminology
Object-oriented programming languages
PHP software
Procedural programming languages
Programming languages
Programming languages created in 1995
Scripting languages
Software using the PHP license
Text-oriented programming languages