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!
== Implementations == The only complete PHP implementation is the original, known simply as PHP. It is the most widely used and is powered by the [[Zend Engine]]. To disambiguate it from other implementations, it is sometimes unofficially called "Zend PHP". The Zend Engine [[Compiler|compiles]] PHP [[source code]] on-the-fly into an internal format that it can execute, thus it works as an [[Interpreter (computing)|interpreter]].<ref>{{cite web|access-date=2009-11-04|url=http://www.linux-tutorial.info/modules.php?name=Howto&pagename=Unix-and-Internet-Fundamentals-HOWTO/languages.html|title=How do computer languages work?|archive-date=2011-07-16|archive-url=https://web.archive.org/web/20110716214917/http://www.linux-tutorial.info/modules.php?name=Howto&pagename=Unix-and-Internet-Fundamentals-HOWTO/languages.html|url-status=dead}}</ref><ref>{{cite book |title=Beginning PHP and MySQL 5: From Novice to Professional |author=Gilmore, W. Jason |page=[https://archive.org/details/beginningphpmysq0000gilm/page/43 43] |date=2006-01-23 |publisher=Apress |isbn=1-59059-552-1 |url=https://archive.org/details/beginningphpmysq0000gilm/page/43 }}</ref> It is also the "reference implementation" of PHP, as PHP has no formal specification, and so the semantics of Zend PHP define the semantics of PHP. Due to the complex and nuanced semantics of PHP, defined by how Zend works, it is difficult for competing implementations to offer complete compatibility.<ref>{{cite web |title=PHP Internals Book |url=https://www.phpinternalsbook.com |author1=Julien Pauli |author2=Nikita Popov |author3=Anthony Ferrara |website=PHP Internals Book |access-date=2025-01-21 |archive-date=2025-01-21 |archive-url=https://web.archive.org/web/20250121000000/https://www.phpinternalsbook.com |url-status=live}}</ref> PHP's single-request-per-script-execution model, and the fact that the Zend Engine is an interpreter, leads to inefficiency; as a result, various products have been developed to help improve PHP performance. In order to speed up execution time and not have to compile the PHP source code every time the web page is accessed, PHP scripts can also be deployed in the PHP engine's internal format by using an [[opcode]] cache, which works by [[Cache (computing)|caching]] the compiled form of a PHP script (opcodes) in [[Shared memory (interprocess communication)|shared memory]] to avoid the overhead of [[parsing]] and [[compiling]] the code every time the script runs. An opcode cache, [[Zend Opcache]], is built into PHP since version 5.5.<ref>{{cite web | title = [VOTE] Integrating Zend Optimizer+ into the PHP distribution | url = http://news.php.net/php.internals/66531 | access-date = 2013-03-08 | website = news.php.net }}</ref> Another example of a widely used opcode cache is the [[Alternative PHP Cache]] (APC), which is available as a [[PHP Extension Community Library|PECL]] extension.<ref>{{cite web | url = http://www.php.net/manual/en/book.apc.php | title = Alternative PHP Cache | access-date = 2013-09-21 | website = PHP.net | archive-date = 2013-11-15 | archive-url = https://web.archive.org/web/20131115071936/http://php.net/manual/en/book.apc.php | url-status = dead }}</ref> While Zend PHP is still the most popular implementation, several other implementations have been developed. Some of these are [[compiler]]s or support [[JIT compilation]], and hence offer performance benefits over Zend PHP at the expense of lacking full PHP compatibility.{{Citation needed|date=November 2023}} Alternative implementations include the following: * [[HHVM]] (HipHop Virtual Machine) β developed at Facebook and available as open source, it converts PHP code into a high-level bytecode (commonly known as an [[intermediate language]]), which is then translated into x86-64 machine code dynamically at runtime by a [[Just-in-time compiler|just-in-time]] (JIT) compiler, resulting in up to 6Γ performance improvements.<ref>{{cite web|url=http://www.hhvm.com/blog/2813/we-are-the-98-5-and-the-16 |title=We are the 98.5% (and the 16%) Β« HipHop Virtual Machine |website=hhvm.com |date=December 2013 |access-date=2014-02-23}}</ref> However, since version 7.2 Zend has outperformed HHVM,<ref>{{Cite web|url=https://kinsta.com/blog/php-benchmarks/|title=The Definitive PHP 5.6, 7.0, 7.1, 7.2 & 7.3 Benchmarks (2019)|date=2019-01-14 |access-date=2019-04-19}}</ref> and HHVM 3.24 is the last version to officially support PHP.<ref>{{Cite web|url=https://www.infoworld.com/article/3226489/web-development/forget-php-facebooks-hhvm-engine-switches-to-hack-instead.html|title=Forget PHP! Facebook's HHVM engine switches to Hack instead|last=Krill|first=Paul|date=2017-09-20|website=InfoWorld |access-date=2019-02-06}}</ref> ** [[HipHop for PHP|HipHop]] β developed at Facebook and available as open source, it transforms the PHP scripts into [[C++]] code and then compiles the resulting code, reducing the server load up to 50%. In early 2013, Facebook deprecated it in favour of HHVM due to multiple reasons, including deployment difficulties and lack of support for the whole PHP language, including the <code>create_function()</code> and <code>eval()</code> constructs.<ref>{{cite web|title=Announcement on GitHub removing HPHPc support|website=[[GitHub]]|url=https://github.com/facebook/hiphop-php/commit/fc5b95110ff75110ad55bb97f7c93a8c4eb68e3b|access-date=2013-05-24}}</ref> * [[Parrot virtual machine|Parrot]] β a virtual machine designed to run dynamic languages efficiently; the cross-translator Pipp transforms the PHP source code into the [[Parrot intermediate representation]], which is then translated into the Parrot's bytecode and executed by the virtual machine. * [[PeachPie]] β a second-generation compiler to .[[.NET Framework|NET]] [[Common Intermediate Language]] (CIL) bytecode, built on the [[Roslyn (compiler)|Roslyn]] platform; successor of Phalanger, sharing several architectural components * [[Phalanger (compiler)|Phalanger]] β compiles PHP into .Net Common Intermediate Language bytecode; predecessor of PeachPie * [[Quercus (software)|Quercus]] β compiles PHP into [[Java bytecode]]
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)