Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PHP
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Use == [[File:LAMP software bundle.svg|thumb|upright=2|A broad overview of the LAMP software bundle, displayed here together with [[Squid (software)|Squid]] ]] PHP is a general-purpose scripting language that is especially suited to [[server-side scripting|server-side]] [[web development]], in which case PHP generally runs on a [[web server]]. Any PHP code in a requested file is [[execution (computing)|executed]] by the PHP runtime, usually to create [[dynamic web page]] content or dynamic images used on websites or elsewhere.<ref>{{cite web|url=https://php.net/manual/en/book.image.php |title=PHP Manual Image Processing and GD; |publisher= php.net |access-date=2011-04-09}}</ref> It can also be used for [[command-line]] scripting and [[client-side]] [[graphical user interface]] (GUI) applications. PHP can be deployed on most web servers, many [[operating system]]s and [[computing platform|platforms]], and can be used with many [[relational database management system]]s (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.<ref name="O'Reilly-2001">{{cite web|access-date=2008-02-25|url=http://www.onlamp.com/pub/a/php/2001/05/03/php_foundations.html|title=Embedding PHP in HTML|publisher=O'Reilly|date=2001-05-03|archive-date=2008-02-19|archive-url=https://web.archive.org/web/20080219180226/http://www.onlamp.com/pub/a/php/2001/05/03/php_foundations.html|url-status=dead}}</ref> [[File:Scheme dynamic page en.svg|thumb|upright=2|Dynamic web page: example of [[server-side scripting]] (PHP and MySQL)]] Originally designed to create dynamic [[web page]]s, PHP now focuses mainly on [[server-side scripting]],<ref>{{cite web|url=http://webmaster.iu.edu/PHPlanguage/index.shtml|title=PHP Server-Side Scripting Language|publisher=[[Indiana University]]|access-date=2008-02-25|date=2007-04-04|archive-url=https://web.archive.org/web/20160121223739/http://webmaster.iu.edu/tools-and-guides/programming-languages/php.phtml|archive-date=2016-01-21}}</ref> and it is similar to other server-side scripting languages that provide dynamic content from a web server to a [[client (computing)|client]], such as [[Python (programming language)|Python]], [[Microsoft]]'s [[ASP.NET]], [[Sun Microsystems]]' [[JavaServer Pages]],<ref>{{cite web|url=http://java.sun.com/products/jsp/jspservlet.html|title=JavaServer Pages Technology β JavaServer Pages Comparing Methods for Server-Side Dynamic Content White Paper|publisher=Sun Microsystems|access-date=2008-02-25}}</ref> and <code>[[mod_perl]]</code><!-- do not remove the underscore from mod_perl: it is part of the name -->. PHP has also attracted the development of many [[software framework]]s that provide building blocks and a design structure to promote [[rapid application development]] (RAD).{{Citation needed|date=November 2023}} Some of these include [[PRADO (framework)|PRADO]], [[CakePHP]], [[Symfony]], [[CodeIgniter]], [[Laravel]], [[Yii Framework]], [[Phalcon (framework)|Phalcon]] and [[Laminas]], offering features similar to other [[web framework]]s. The [[LAMP (software bundle)|LAMP architecture]] has become popular in the web industry as a way of deploying web applications.<ref>{{cite web|url=http://www.ibm.com/developerworks/library/os-5waystunelamp/index.html|title=Five simple ways to tune your LAMP application| website=[[IBM]] |date=2011-01-25}}</ref> PHP is commonly used as the ''P'' in this bundle alongside [[Linux]], [[Apache HTTP Server|Apache]] and [[MySQL]], although the ''P'' may also refer to [[Python (programming language)|Python]], [[Perl]], or some mix of the three. Similar packages, [[WAMP (software bundle)|WAMP]] and [[MAMP]], are also available for [[Microsoft Windows|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.{{Citation needed|date=November 2023}} For specific and more advanced usage scenarios, PHP offers a well-defined and documented way for writing custom extensions in [[C (programming language)|C]] or [[C++]].<ref>{{cite web | url = http://www.php.net/manual/en/internals2.structure.php | title = PHP at the core: Extension structure | access-date = 2013-09-22 | website = PHP.net | archive-date = 2013-09-26 | archive-url = https://web.archive.org/web/20130926082102/http://www.php.net/manual/en/internals2.structure.php | url-status = dead }}</ref><ref>{{cite web | url = http://www.php.net/manual/en/internals2.counter.php | title = PHP at the core: The "counter" Extension β A Continuing Example | access-date = 2013-09-22 | website = PHP.net | archive-date = 2013-09-26 | archive-url = https://web.archive.org/web/20130926082106/http://www.php.net/manual/en/internals2.counter.php | url-status = dead }}</ref><ref>{{cite web | url = http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/ | title = Extension Writing Part I: Introduction to PHP and Zend | date = 2005-03-01 | access-date = 2013-09-22 | publisher = [[Zend Technologies]] | archive-url = https://web.archive.org/web/20130924233638/http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/ | archive-date = 2013-09-24 | url-status = dead }}</ref><ref>{{cite web | url = http://devzone.zend.com/317/extension-writing-part-ii-parameters-arrays-and-zvals/ | title = Extension Writing Part II: Parameters, Arrays, and ZVALs | date = 2005-06-06 | access-date = 2013-09-22 | publisher = [[Zend Technologies]] | archive-url = https://web.archive.org/web/20130926091658/http://devzone.zend.com/317/extension-writing-part-ii-parameters-arrays-and-zvals/ | archive-date = 2013-09-26 | url-status = dead }}</ref><ref>{{cite web | url = http://devzone.zend.com/318/extension-writing-part-ii-parameters-arrays-and-zvals-continued/ | title = Extension Writing Part II: Parameters, Arrays, and ZVALs (continued) | date = 2005-06-06 | access-date = 2013-09-22 | publisher = [[Zend Technologies]] | archive-url = https://web.archive.org/web/20130926091655/http://devzone.zend.com/318/extension-writing-part-ii-parameters-arrays-and-zvals-continued/ | archive-date = 2013-09-26 | url-status = dead }}</ref><ref>{{cite web | url = http://devzone.zend.com/446/extension-writing-part-iii-resources/ | title = Extension Writing Part III: Resources | date = 2006-05-12 | access-date = 2013-09-22 | publisher = [[Zend Technologies]] | archive-url = https://web.archive.org/web/20130926091645/http://devzone.zend.com/446/extension-writing-part-iii-resources/ | archive-date = 2013-09-26 | url-status = dead }}</ref><ref>{{cite web | url = http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/ | title = Wrapping C++ Classes in a PHP Extension | date = 2009-04-22 | access-date = 2013-09-22 | publisher = [[Zend Technologies]] | archive-url = https://web.archive.org/web/20130920011549/http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/ | archive-date = 2013-09-20 | url-status = dead }}</ref>{{Primary source inline|date=November 2023|reason=Since this is a broad generalization, secondary sources are required}} Besides extending the language itself in form of additional [[Library (computing)|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]].<ref>{{cite web | url = https://stackoverflow.com/q/1110682 | title = Extending PHP with C++? | access-date = 2013-09-22 | publisher = [[Stack Overflow]] }}</ref><ref>{{cite web | url = https://stackoverflow.com/q/1502244 | title = How can I use C++ code to interact with PHP? | access-date = 2013-09-22 | publisher = [[Stack Overflow]] }}</ref> PHP also offers well-defined ways for embedding itself into other software projects. That way PHP can be easily used as an internal [[scripting language]] for another project, also providing tight interfacing with the project's specific internal [[data structure]]s.<ref>{{cite book | title = Extending and Embedding PHP | first = Sara | last = Golemon | year = 2006 | publisher = Sams | isbn = 978-0-672-32704-9 }}</ref> PHP received mixed reviews due to lacking support for [[Multithreading (software)|multithreading]] at the core language level,<ref>{{cite web | url = https://bugs.php.net/bug.php?id=46919 | title = Request #46919: Multithreading | access-date = 2013-09-22 | website = PHP.net }}</ref> though using threads is made possible by the "pthreads" [[PHP Extension Community Library|PECL]] extension.<ref>{{cite web | url = http://www.php.net/manual/en/intro.pthreads.php | title = pthreads: Introduction (PHP Manual) | access-date = 2013-09-22 | website = PHP.net }}</ref><ref>{{cite web|url=https://pecl.php.net/package/pthreads |title=PECL :: Package :: pthreads |website=pecl.php.net |access-date=2014-02-09}}</ref> A command line interface, php-cli, and two [[ActiveX]] [[Windows Script Host]] scripting engines for PHP have been produced.{{Citation needed|date=November 2023}} === Popularity and usage statistics === PHP is used for [[Web content management system]]s including [[MediaWiki]],<ref>{{cite web|date=2010-01-25|title=Manual:Installation requirements#PHP|url=http://www.mediawiki.org/w/index.php?title=Manual:Installation_requirements&oldid=299556#PHP|access-date=2010-02-26|publisher=MediaWiki|quote=PHP is the programming language in which MediaWiki is written [...]}}</ref> [[WordPress]],<ref>{{cite web|title=About WordPress|url=http://wordpress.org/about/|access-date=2010-02-26|quote=WordPress was [...] built on PHP}}</ref> [[Joomla]],<ref>{{cite web|last=Kempkens|first=Alex|title=Joomla! β Content Management System to build websites & apps|url=http://www.joomla.org/about-joomla.html}}</ref> [[Drupal]],<ref>{{cite web|title=PHP and Drupal|date=16 September 2007|url=http://drupal.org/node/176052|access-date=2010-06-13|publisher=Drupal.org|archive-date=2010-02-08|archive-url=https://web.archive.org/web/20100208205523/http://drupal.org/node/176052|url-status=dead}}</ref> [[Moodle]],<ref>{{cite web|title=About|url=http://docs.moodle.org/en/About_Moodle|access-date=2009-12-20|publisher=Moodle.org|archive-date=2010-01-11|archive-url=https://web.archive.org/web/20100111055644/http://docs.moodle.org/en/About_Moodle|url-status=dead}}</ref> [[eZ Publish]], [[eZ Platform]], and [[SilverStripe]].<ref>{{cite web|title=Server requirements of SilverStripe|url=http://doc.silverstripe.org/framework/en/installation/server-requirements|url-status=dead|archive-url=https://web.archive.org/web/20141128063118/http://doc.silverstripe.org/framework/en/installation/server-requirements|archive-date=28 November 2014|access-date=13 October 2014|quote=SilverStripe requires PHP 5.3.2+}}</ref> {{As of|2013|1}}, PHP was used in more than 240 million [[website]]s (39% of those sampled) and was installed on 2.1 million [[web server]]s.<ref>{{cite web | url=http://news.netcraft.com/archives/2013/01/31/php-just-grows-grows.html | title=PHP just grows & grows | date=2013-01-31 | access-date=2013-04-01 | author=Ide, Andy}}</ref> {{As of|2025|05|21}} (six months after PHP 8.4's release), PHP is used as the server-side programming language on 74.2% of websites where the language could be determined; PHP 8 is the most used version of the language with 45.3% of websites using PHP being on that version, while 43.7% use PHP 7, 10.9% use PHP 5 and 0.1% use PHP 4.<ref name="W3Techs β World Wide Web Technology Surveys">{{cite web |title=Usage statistics of PHP for websites |url=https://w3techs.com/technologies/details/pl-php |website=W3Techs β World Wide Web Technology Surveys |publisher=W3Techs |access-date=21 May 2025}}</ref> {{Stacked bar |A1=45.3|T1=PHP 8<br />45.3%|C1=linear-gradient(to right, #66FF66 1.7%, #D4F4B4 14.7%, #FEF8C6 30.1%, #FFCC66, #FF7800); <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> |A2=43.7|T2=PHP 7<br />43.7%|C2=linear-gradient(to right, #dc2626 74.3%, #ef4444, #f87171, #fca5a5, #fecaca); |A3=10.9|T3=PHP 5<br />10.9%|C3=linear-gradient(to right, #075985 54.3%, #0369a1, #0284c7, #0ea5e9, #38bdf8, #7dd3fc, #bae6fd); |A4=0.1|T4=PHP 4<br />0.1%|C4=#d4d4d4; }} {{Pie chart |radius = 160 <!-- PHP version 8 (45.3%) --> |value1 = 0.77 <!-- Formula: Version 8.4 is used by 1.7% of all the websites who use PHP version 8, so 45.3 / 100 * 1.7 = 0.77 --> |label1 = PHP 8.4: 1.7% of PHP 8 |color1 = #66FF66 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> |value2 = 6.16 <!-- Formula: Version 8.3 is used by 13.6% of all the websites who use PHP version 8, so 45.3 / 100 * 13.6 = 6.16 --> |label2 = PHP 8.3: 13.6% of PHP 8 |color2 = #D4F4B4 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> |value3 = 15.76 |label3 = PHP 8.2: 34.8% of PHP 8 |color3 = #FEF8C6 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> |value4 = 13.77 |label4 = PHP 8.1: 30.4% of PHP 8 |color4 = #FFCC66 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> |value5 = 8.88 |label5 = PHP 8.0: 19.6% of PHP 8 |color5 = #FF7800 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch --> <!-- PHP version 7 (47.3%) --> |value6 = 32.47 <!-- Formula: Version 7.4 is used by 74.3% of all the websites who use PHP version 7, so 47.3 / 100 * 74.3 = 32.47 --> |label6 = PHP 7.4: 74.3% of PHP 7 |color6 = #dc2626 |value7 = 4.59 |label7 = PHP 7.3: 10.5% of PHP 7 |color7 = #ef4444 |value8 = 3.54 |label8 = PHP 7.2: 8.10% of PHP 7 |color8 = #f87171 |value9 = 1.53 |label9 = PHP 7.1: 3.50% of PHP 7 |color9 = #fca5a5 |value10 = 1.53 |label10 = PHP 7.0: 3.50% of PHP 7 |color10 = #fecaca <!-- PHP version 5 (10.9%) --> |value11 = 5.9187 |label11 = PHP 5.6: 54.3% of PHP 5 |color11 = #075985 |value12 = 0.8720 |label12 = PHP 5.5: 8.00% of PHP 5 |color12 = #0369a1 |value13 = 1.6786 |label13 = PHP 5.4: 15.4% of PHP 5 |color13 = #0284c7 |value14 = 1.6350 |label14 = PHP 5.3: 15.0% of PHP 5 |color14 = #0ea5e9 |value15 = 0.7521 |label15 = PHP 5.2: 6.90% of PHP 5 |color15 = #38bdf8 |value16 = 0.0436 |label16 = PHP 5.1: 0.40% of PHP 5 |color16 = #7dd3fc |value17 = 0 |label17 = PHP 5.0: less than 0.1% of PHP 5 |color17 = #bae6fd <!-- PHP version 4 (0.1%) --> |value18 = 0.0726 |label18 = PHP 4.4: 72.6% of PHP 4 |color18 = #525252 |value19 = 0.0234 |label19 = PHP 4.3: 23.4% of PHP 4 |color19 = #737373 |value20 = 0.0025 |label20 = PHP 4.2: 2.50% of PHP 4 |color20 = #a3a3a3 |value21 = 0.0008 |label21 = PHP 4.1: 0.80% of PHP 4 |color21 = #d4d4d4 |value22 = 0.0007 |label22 = PHP 4.0: 0.70% of PHP 4 |color22 = #e5e5e5 |caption = Usage share of PHP versions on 21 May 2025:<br /> six months after PHP 8.4's release<ref name="W3Techs β World Wide Web Technology Surveys" /><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/4|title=Usage Statistics and Market Share of PHP Version 4 for Websites, May 2025|website=w3techs.com}}</ref><ref name="w3techs.com">{{Cite web|url=https://w3techs.com/technologies/details/pl-php/5|title=Usage Statistics and Market Share of PHP Version 5 for Websites, May 2025|website=w3techs.com}}</ref><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/7|title=Usage Statistics and Market Share of PHP Version 7 for Websites, May 2025|website=w3techs.com}}</ref><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/8|title=Usage Statistics and Market Share of PHP Version 8 for Websites, May 2025|website=w3techs.com}}</ref> }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)