from Wikipedia, the free encyclopedia
Basic data
Publishing year: June 8, 1995
Designer: Rasmus Lerdorf
Developer: Rasmus Lerdorf , Andi Gutmans , PHP Group, Zend Technologies , Zeev Suraski
Current  version : 7.4.9   (August 6, 2020)
Important implementations : Zend Engine , HHVM , Phalanger (Compiler)
Influenced by: C ++ , Perl , C , Java , Tcl
Operating system : unixoid system , Microsoft Windows
License : PHP license

PHP ( recursive acronym and Backronym for " P HP: H ypertext P reprocessor " original " P ersonal H ome P age Tools") is a scripting language with at C and Perl ajar syntax mainly to create dynamic Web sites or Web applications is used . PHP is distributed as free software under the PHP license . PHP is characterized by broad database support and Internet protocol integration as well as the availability of numerous function libraries.

Hello world program

One of several possible versions of the Hello World program in PHP:

    echo 'Hallo Welt!';


Since its release in 1995, developers have made extensive changes within the programming language. The core of the language was completely rebuilt with PHP 3. Significant adjustments were made with PHP 5 and PHP 5.3, which put the focus of the programming language on object-oriented programming . However, classes were already usable with the fourth version .

Personal Home Page Tools (PHP1)

PHP was developed by Rasmus Lerdorf in 1995 . At that time the term still stood for Personal Home Page Tools and was originally intended as a replacement for a collection of Perl scripts that Lerdorf had written to log the accesses to his online resume.

PHP / FI (PHP 2)

Lerdorf soon created a more extensive version in the C programming language , in which PHP is still being developed today. The PHP / FI (FI stood for form interpreter ) that was finally released was very similar to Perl, albeit in a more limited way.


PHP 3 was rewritten by Andi Gutmans and Zeev Suraski in 1997, as PHP / FI 2, which had since been released, was in their opinion insufficient for e-commerce . Lerdorf now cooperated with Gutmans and Suraski, and so the development of PHP / FI was stopped. The PHP3 version significantly advanced the spread of the PHP web scripting language. The new language was simply released under the name PHP , a recursive acronym for PHP: Hypertext Preprocessor , to remove the personal use implication that existed in the previous versions of PHP and PHP / FI.


Zend Technologies Ltd., founded by Gutmans and Suraski . subsequently developed the Zend Engine 1, which forms the core of the PHP 4 standard implementation. With PHP 4, the execution speed of complex applications and the security when using global variables have been improved. Support for many other web servers, session management, output buffering and a number of new language constructs were introduced.

Since the World Wide Web grew rapidly in the late 1990s, there was a great need for scripting languages ​​that can be used to create dynamic websites. Over time, PHP became more popular for web development than the previous de facto standard Perl because its specialization made it easier to learn.

Further development and support have been discontinued since 2008.


In the summer of 2004 a further development stage was published with version 5.0. The main difference to its predecessor is the Zend Engine II, which primarily uses an improved object model, thus executing object-oriented applications more efficiently and enabling language constructs such as overloading . There are also exceptions , reflection , the integration of the SQLite database and extensions to XML and DOM handling.

Originally planned as the early successor to PHP 5, development of PHP 6 has been discontinued. Among other things, it was planned to support various Unicode standards. Some improvements are implemented in PHP versions 5.3 and higher.

Further possibilities in the context of object-oriented programming were advanced with PHP 5.3 ( namespaces , late static bindings), 5.4 ( traits , array and constructor dereferencing) and 5.5 ( generators ). Version 5.6 introduced variadic functions as a native language feature and argument unpacking to allow the use of a variable number of parameters.

In mid-2011, the developers decided to standardize the, according to their own statements, chaotic release process. Accordingly, new versions should appear regularly and support for older versions should be guaranteed with a fixed period of time.

The further development of PHP 5.4 was stopped in autumn 2015. Security updates are no longer available since PHP 5.4.45 was released on September 3, 2015.

The further development of PHP 5.5 was stopped on July 21, 2016.

Active support for PHP 5.6 was discontinued on January 1st, 2017. Security support was also discontinued on December 31, 2018. Security updates for these versions will only be made available in special cases.


After a discussion about whether the next PHP version should resume the name of the failed PHP 6, or instead skip a version number and call it PHP 7, it was announced on July 29, 2014 that the developers would vote 58 to 24 for the Major version number 7 have chosen. The successor to PHP 5 is officially called PHP 7 .

PHP 7 has up to 30 percent less execution time than PHP 5 because hash tables have been newly implemented, among other things . Thanks to various optimizations on the PHP core, the new version also requires less storage space than its predecessor. Components such as parsers, lexers and bytecode generators have also undergone some changes. The first pre-release version (Alpha 1) was released on June 11, 2015, the finished version on December 3, 2015. During the development of PHP 7, downward compatibility was partially abandoned, the widespread "mysql" class was dropped. New features include engine exceptions, anonymous classes and CSPRNG functions. Active support for PHP 7.0 ended on December 3, 2017. Exactly one year later, on December 3, 2018, security support for this version is also to be discontinued.

PHP 7.1 was released at the beginning of December 2016.

On November 30, 2017, PHP 7.2 followed after a four-month beta phase. The new features of the current version are primarily intended to provide more clarity.

PHP 7.3 was released on December 6th, 2018. It should show a significantly improved performance.

Version 7.3.11 has been available since October 24, 2019, after it was revealed that NGINX servers with PHP-FPM could be remotely attacked.

PHP 7.4 was released on November 28, 2019.


The LAMP software bundle (here also with Squid ) includes PHP.

PHP was deployed on approximately 244 million websites in early 2013 and was used as the server-side programming language by 79% of all websites in early 2019 . PHP is the most common programming language used on the server side for creating websites. It is also preinstalled on most web hosts .


Presentation of how PHP works

PHP is a system that processes PHP code on the server side . This means that the source text is not sent to the web browser , but to an interpreter on the web server . Only the output of the PHP interpreter is sent to the browser. In most cases this is an HTML document, although PHP can also be used to generate other file types , such as images or PDF files.

In order to be able to execute a PHP file in the context of a web application , one needs a system that can handle the instructions contained in the file. For this reason , the interpreter is executed by a server daemon or server service such as Apache or IIS through an interface such as ISAPI or CGI . The combination of Linux / Windows / macOS as operating system , Apache as web server, MySQL as database system and PHP is called LAMP (for Linux), WAMP (for Windows) or MAMP (for Mac OS X). Ready-made LAMP, MAMP and WAMP packages, which make the individual loading and configuration of packages from the Internet unnecessary, are developed in the XAMPP project. There are versions for Linux, Solaris , Windows and Mac OS X, but these should only be used for test and development environments.

Since PHP normally runs in a web server environment, it is also subject to stateless HTTP . Each PHP page loads the web server through the interpreter, and the interpreter processes the source text again each time it is called. This slows down the server's reaction time and increases the load. To counteract this, various bytecode caches are available, which temporarily store a version of the program that has been prepared for execution and thus accelerate access to this file the next time it is called (see also section bytecode caching and article PHP accelerator ).

PHP can also be used to write command line-oriented scripts that are independent of the Internet. The Qt extension and the GTK extension even provide a programming interface for a graphical user interface for which neither a web server nor a browser are required. The first versions of the interfaces to the graphical user interface and to other operating system functions were sparse and rarely used. The currently developed PHP-GTK version 2, on the other hand, aims to cover the GTK API by 95%. Currently, however, PHP is mainly used on web servers.



Three different types of comments are possible in PHP.

// einzeiliger Kommentar

# einzeiliger Kommentar

/* mehrzeiliger
   Kommentar */


A PHP script can be integrated into HTML.

       <?php echo 'Hallo Welt!'; ?>

Integration of files

External files can be integrated into a PHP script. There are four different instructions for doing this.

require 'pfad/datei.php';      // wenn die Datei nicht eingebunden werden kann, folgt ein Fehler
include 'pfad/datei.php';      // wenn die Datei nicht eingebunden werden kann, folgt eine Warnung
require_once 'pfad/datei.php'; // bindet die Datei nur ein, wenn sie zuvor noch nicht eingebunden wurde
include_once 'pfad/datei.php'; // bindet die Datei nur ein, wenn sie zuvor noch nicht eingebunden wurde


Variables do not have to be declared in PHP . Variable names must begin with the dollar sign .

$variable = 'wert';


Constants must be declared in PHP . They are created using define('name', wert);global or in classes using const name = wert;local. Since PHP 7.1, class constants can also have a visibility (without explicit specification they are automatic as in earlier PHP versions public). It is common practice to capitalize constant names, but this is not required by the language.

define('MEINE_KONSTANTE', 'wert');

class MyClass
    protected const KLASSEN_KONSTANTE = 420;

A constant cannot be edited afterwards. Class constants exist once per class, not per instance of the class, and thus behave like static properties of the class.

Data types

The data type of a variable is usually not determined by the programmer in the source code, but automatically during runtime . It results from the context in which a variable is used. Explicit type conversions are possible. As of version 7, functions can also prescribe simple types for their parameters and their return value - this was already possible before for arguments that contain arrays or classes.

// Skalare Datentypen
$wahrheitswert = true;         // boolean
$ganzzahl = 5;                 // integer
$kommazahl = 4.71;             // float (oder double)
$zeichenkette = 'foo';         // string

// Zusammengesetzte Datentypen
$feld = array('foo', 'bar');   // array
$objekt = new stdClass();      // object
$funktion = function () {      // callable
    echo 'hello world!';

// Spezielle Datentypen
$resource = fopen("foo", "w"); // resource
$variable = NULL;              // NULL



PHP is usually used as a server module, i.e. as part of the web server processes or via FastCGI . If PHP is used as a CGI program, this can have a negative effect on the execution speed, as a new PHP interpreter instance is started for each HTTP request.

Bytecode caching

With the Zend engine, a PHP script is first translated into a (platform-independent) bytecode (Zend opcode), from which machine code has to be generated for execution. The redundant generation of opcode can be avoided by using a bytecode cache . Up to version 5.4 PHP did not have an integrated bytecode cache, which meant that a script had to be recompiled each time it was called. To counteract this, some extensions have been developed that add this functionality, such as the eAccelerator , the alternative PHP Cache , XCache and the commercial Zend Optimizer . Starting with PHP version 5.5, the Zend Optimizer + has now been integrated into the scripting language.

Particularly with extensive scripts, a bytecode cache can significantly increase the speed of execution.


The PHP Compiler (PHC) is an open source compiler from Paul Biggar, which translates PHP scripts into optimized C code and then executes them as a separate web server. The basis for PHC is Biggar's doctoral thesis from 2009 and his many years of research on concepts for converting script languages ​​into compiled languages. With HipHop , another free software for translating PHP code into optimized C ++ code, which can be compiled, has existed since 2010, which, according to the manufacturer, doubles the performance there on average. HipHop was developed by Facebook in order to reduce the server load (according to Facebook by about 40%). It can be found as open source software on GitHub .

Protection systems for PHP installations

Suhosin is a protection system for PHP installations developed by Stefan Esser, a former member of the "PHP Security Response Team" and co-developer of PHP. It was designed to protect the server and users from known and unknown errors in PHP applications and in the PHP core.

Common PHP applications

A selection of some widely used applications developed in PHP:

Forums - software
Invision Power Board , XenForo , MyBB , phpBB , Simple Machines Forum , vBulletin and WoltLab Burning Board
Web frameworks
Laravel , Zend Framework , Symfony , CakePHP , CodeIgniter , Neos Flow , Horde , WoltLab Community Framework , Yii
Graphical user interfaces for managing databases ( e.g. MySQL )
phpMyAdmin , phpPgAdmin , Adminer
Content management (CMS) and blog systems
WordPress , TYPO3 , Joomla , Xoops , Drupal , Contao , WebEdition , Serendipity
Customer relationship management systems (CRM)
SugarCRM and Vtiger
E-commerce applications
osCommerce , xt: Commerce , Magento , PrestaShop , Pimcore , Shopware , OXID eShop
Project management
Picture galleries
Coppermine , 4images , easyImage

License and reference

PHP 3 was distributed under the GNU General Public License (GPL). From version 4 PHP is sold under the PHP License , as the new parser , the Zend Engine , is published by the manufacturer Zend under a license that is not GPL-compatible. The PHP license is a software license that allows the free use and modification of the source code . The software can be downloaded free of charge from the Internet; In addition, PHP is also included in the scope of delivery of some operating systems (such as some Linux distributions or macOS ).

Further developments

Object orientation

Version 5 supports PHP by encapsulation of data destructors by and exception handling exceptions improved and expanded possibilities of object-oriented programming. In PHP 5, object variables are only references to objects and not, as in PHP 4, the objects themselves. Current versions use other concepts of object-oriented programming, so namespaces are supported from version 5.3 and traits from version 5.4 .

Database connection

With the object-oriented database abstraction level PDO , the often criticized inconsistent access to different databases in version 5.1 was counteracted.

Storage optimization

In PHP 5.3, a significant improvement in the memory requirements of a PHP script at runtime was achieved using an internal garbage collector . Since then, an additional installation of Zend Optimizer is no longer necessary.

Web server

From version 5.4 a simple web server is integrated which can be configured via the command line . It is not recommended for productive use.


In version 5.6 the standard character set was changed from ISO-8859-1 to UTF-8. To ensure secure processing of Unicode, the multi-byte variants of string processing functions must be used.


Data stored in ordinary variables are only available within an HTTP request (in the so-called request scope ) and are deleted from the memory at the end of the page view. However, a visit by a user usually consists of several page views. Session variables are used to make data such as the products in a shopping cart available for an entire session (in the session scope ). In the standard configuration, PHP saves the session data in the file system of the web server. Data that should be available across sessions (in the application scope ) must be stored on the web server in other ways.


Some PHP modules are not thread safe .

The weak typing of PHP is part of the concept, but also a possible source of errors. An error occurs, for example, when numeric expressions are to be compared with string expressions (operator: == ), whereby the implicit type conversion can lead to unexpected results if no operator for type-safe comparisons (operator: ===) is used. In addition, it is not possible in PHP to force a variable declaration . Rather, variables are implicitly declared when they are used for the first time. This convenience means that typing errors in the variable name can lead to program errors that are difficult to find. To find such problems, the LogLevel E_NOTICE can be activated. This causes an error message to be issued when using an uninitialized variable.

There may be times when functions do not throw an exception in the event of an error. This means that standardized error handling is not possible. With the help of "set_error_handler", individual error handling can be defined for these cases. Since PHP 7, many fatal errors can be caught using exception handling similar to exceptions.


General introductions

Special topics

Web links

Commons : PHP  - collection of images, videos and audio files
Wikibooks: Website Development: PHP  - Learning and Teaching Materials
Wiktionary: PHP  - explanations of meanings, word origins, synonyms, translations

Individual evidence

  1. Google Groups . (accessed December 11, 2018).
  2. PHP: History of PHP - Manual . (accessed on August 25, 2016).
  3. .
  4. a b .
  5. . (accessed on August 14, 2018).
  6. PHP 7 ChangeLog. In: Retrieved August 7, 2020 (English).
  7. a b c PHP: Preface - Manual . (accessed on August 25, 2016).
  8. . (accessed on August 25, 2016).
  9. ^ Rasmus Lerdorf | PHP on hormones . July 29, 2013 (accessed March 19, 2016).
  10. . (accessed on August 25, 2016).
  11. ^ Rasmus Lerdorf: "PHP's design goal from the very beginning is very simple. To solve the common web problem. That's it. "
  12. PHP Manual: Database Extensions
  13. PHP Manual: Extensions
  14. ^ Announcement by Rasmus Lerdorf about PHP 1.0 in the newsgroup comp.infosystems.www.authoring.cgi
  15. The History of PHP on, accessed September 4, 2013.
  16. Resetting PHP6
  17. ^ The Good, the Bad, and the Ugly: What Happened to Unicode and PHP 6
  18. An overview of the development of PHP 5.4 ,, accessed on March 21, 2013.
  19. New features New functions for PHP 5.4 at a glance (accessed on March 21, 2013)
  20. What's new in PHP 5.6? (No longer available online.) In: Archived from the original on March 24, 2016 ; accessed on March 16, 2016 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot /
  21. RFC: releaseprocess , draft and vote on a unified release process, (English), accessed on March 21, 2013.
  22. PHP: Unsupported Branches. In: Retrieved March 16, 2016 .
  24. Supported Versions ,, English
  25. PHP: News Archive - 2016. In: Retrieved July 26, 2016 .
  26. PHP: Supported Versions. In: Retrieved March 16, 2016 .
  27. php.internals: Re: Name of Next Release of PHP (again)
  28. PHP RFC: Name of Next Release of PHP
  29. PHP7: PHP significantly reduces array memory requirements ,
  30. PHP7: shorter loading and access times on the web. In: 1 & 1 Digital Guide. January 11, 2018, accessed September 15, 2018 .
  31. PHP breaks backward compatibility
  32. Currently Supported Versions., accessed November 22, 2018 .
  33. Programming languages: PHP 7.2 will be released on time. In: Retrieved December 4, 2017 .
  34. PHP 7 ChangeLog. In: Retrieved November 21, 2019 .
  35. Alexander Neumann: Update released: What's new in PHP 7.3. In: December 6, 2018, accessed December 16, 2018 .
  36. heise online: Updates for PHP7: NGINX servers with PHP-FPM were remotely vulnerable. Retrieved October 29, 2019 .
  37. CVE-2019-11043: Vulnerability in PHP-FPM Could Lead to Remote Code Execution on nginx. October 24, 2019, accessed on October 29, 2019 (German).
  38. PHP 7.4.0 Released! In: Accessed December 1, 2019 .
  39. PHP just grows & grows , results of a Netcraft study, January 2013 (English), accessed on February 1, 2013.
  40. Usage of server-side programming languages ​​for websites. Retrieved April 16, 2019 .
  41. Historical yearly trends in the usage of server-side programming languages for websites. Retrieved January 20, 2015 .
  42. Security warning from the XAMPP developers ,, accessed on September 4, 2013.
  43. (English), accessed June 17, 2007.
  44. Opcode cache: Zend Optimizer + is integrated in PHP 5.5 ,
  45. ^ Sascha A. Carlin: PHP on Fire: Five Opcode Caches compared. In: October 15, 2006, accessed June 29, 2010 .
  46. ^ Paul Biggar: PHP Compiler (PHC) based on a doctoral thesis lasting several years. October 1, 2009, accessed July 29, 2011 .
  47. ^ Paul Biggar: Design and Implementation of an Ahead-of-Time Compiler for PHP. Trinity College Dublin, October 1, 2009, accessed July 29, 2011 .
  48. Alexander Neumann: Facebook wants to accelerate PHP. In: heise Developer. heise Zeitschriften Verlag, February 3, 2010, accessed on February 23, 2010 .
  49. Main page of the Suhosin project
  50. "PHP security: Stefan Esser throws down" , of December 13, 2006.
  51. PHP Manual: Namespaces
  52. PHP: Description of the php.ini directives of the language core - Manual. Retrieved December 27, 2019 .
  53. PHP: Multibyte String Functions - Manual. Retrieved December 27, 2019 .
  54. Stephan Schmidt: PHP Design Patterns ,. 2nd Edition. O'Reilly, Cologne 2009, pp. 403f.
  55. PHP manual: option error_reporting
  56. set_error_handler - Specifies a user-defined function for error handling , PHP documentation