Skip to content

PHP

What Is PHP?

PHP code is usually processed on a web server by a PHP interpreter implemented as a module, a daemon or as a Common Gateway Interface (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 or binary image data – would form the whole or part of an HTTP response. Various web template systems, web content management systems, and web frameworks exist which can be employed to orchestrate or facilitate the generation of that response. Additionally, this scripting language can be used for many programming tasks outside of the web context, such as standalone graphical applications and robotic drone control. This scripting language code can also be directly executed from the command line.

The standard PHP interpreter, powered by the Zend Engine, is free software released under the PHP License. This scripting language has been widely ported and can be deployed on most web servers on almost every operating system and platform, free of charge.

This scripting language evolved without a written formal specification or standard until 2014, with the original implementation acting as the de facto standard which other implementations aimed to follow. Since 2014, work has gone on to create a formal PHP specification.

Use of PHP?

PHP is a general-purpose scripting language that is especially suited to server-side web development, in which case this scripting language generally runs on a web server. Any PHP code in a requested file is executed by the PHP runtime, usually to create dynamic web page content or dynamic images used on websites or elsewhere. It can also be used for command-line scripting and client-side graphical user interface (GUI) applications. This scripting language can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems (RDBMS). Most web hosting providers support PHP for use by their clients. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.

The LAMP architecture has become popular in the web industry as a way of deploying web applications. This scripting language is commonly used as the P in this bundle alongside LinuxApache and MySQL, although the P may also refer to PythonPerl, or some mix of the three. Similar packages, WAMP and MAMP, are also available for Windows and macOS, with the first letter standing for the respective operating system. Although both PHP and Apache are provided as part of the macOS base install, users of these packages seek a simpler installation mechanism that can be more easily kept up to date.

For specific and more advanced usage scenarios, This scripting language offers a well defined and documented way for writing custom extensions in C or C++. Besides extending the language itself in form of additional libraries, extensions are providing a way for improving execution speed where it is critical and there is room for improvements by using a true compiled language. This scripting language also offers well defined ways for embedding itself into other software projects. That way this scripting language can be easily used as an internal scripting language for another project, also providing tight interfacing with the project’s specific internal data structures.

PHP received mixed reviews due to lacking support for multithreading at the core language level, though using threads is made possible by the “pthreads” PECL extension.

A command line interface, php-cli, and two ActiveX Windows Script Host scripting engines for PHP have been produced.