The PHP Interpreter https://www.php.net
  • C 65.3%
  • PHP 32%
  • C++ 0.9%
  • Shell 0.4%
  • M4 0.4%
  • Other 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
lacatoire 5c230f1e03
ext/sockets: Fix socket_recvmsg() error state and EAGAIN warning
socket_recvmsg() stores a failure only in the global last error and always
warns, so socket_last_error($socket) does not see it and a non-blocking socket
warns for EAGAIN. It now uses PHP_SOCKET_ERROR() like socket_sendmsg(),
socket_recv() and socket_recvfrom().

Close GH-26030
2026-12-04 13:18:24 +00:00
.circleci Merge branch 'PHP-8.5' 2026-02-27 15:05:28 +01:00
.github Revert "Update IR (#25977)" (#26052) 2026-12-04 00:14:29 +01:00
benchmark Merge branch 'PHP-8.3' into PHP-8.4 2025-08-06 22:29:36 +02:00
build Merge branch 'PHP-8.6' 2026-12-01 21:20:23 +01:00
docs docs: use private staging repos for stable release tagging and tarballs (#24415) 2026-10-29 09:37:45 +01:00
docs-old Bump libtool to serial 63 from 2.5.4 (#21067) 2026-03-11 12:37:56 -03:00
ext ext/sockets: Fix socket_recvmsg() error state and EAGAIN warning 2026-12-04 13:18:24 +00:00
main sapi: Follow-up for post-merge comments on GH-23386 (#26006) 2026-12-02 17:46:56 -04:00
pear Merge branch 'PHP-8.4' into PHP-8.5 2026-11-02 15:24:52 -08:00
sapi sapi: Follow-up for post-merge comments on GH-23386 (#26006) 2026-12-02 17:46:56 -04:00
scripts phpize: Fail when build files cannot be copied 2026-11-15 10:38:33 +08:00
tests Merge branch 'PHP-8.6' 2026-11-25 00:44:52 +01:00
TSRM perf: move EG() and CG() in ZTS builds into __thread storage (#23227) 2026-11-02 16:23:45 +01:00
win32 Clean up SAPI POST readers (#24057) 2026-11-29 01:56:39 -04:00
Zend Fix re2c -Wunreachable-rules warnings (GH-25997) 2026-12-02 15:06:09 +01:00
.editorconfig Improve php-src docs sphinx build, also on *nix (GH-16743) 2024-11-29 19:29:00 +01:00
.gdbinit perf: move EG() and CG() in ZTS builds into __thread storage (#23227) 2026-11-02 16:23:45 +01:00
.gitattributes Merge branch 'PHP-8.5' into PHP-8.6 2026-11-02 15:25:11 -08:00
.gitignore Merge branch 'PHP-8.5' into PHP-8.6 2026-11-02 15:25:11 -08:00
AGENTS.md [skip ci] Add policy for duplicate PRs (#24613) 2026-10-25 00:30:26 +08:00
buildconf Merge branch 'PHP-8.2' into PHP-8.3 2024-11-09 14:05:38 +01:00
buildconf.bat Fix #79146: cscript can fail to run on some systems 2020-01-21 11:53:11 +01:00
CODING_STANDARDS.md [skip ci] docs: Change example to use Throwable (#23430) 2026-08-24 09:53:07 +02:00
configure.ac PHP-8.5 is now for PHP 8.5.15-dev 2026-12-01 15:17:07 -08:00
CONTRIBUTING.md [skip ci] Add policy for duplicate PRs (#24613) 2026-10-25 00:30:26 +08:00
EXTENSIONS Merge branch 'PHP-8.5' into PHP-8.6 2026-10-11 02:14:44 +08:00
gcovr.cfg coverage: exclude zend_parse_parameters_debug_error() (#25454) 2026-11-30 14:01:18 +00:00
LICENSE license-update: update Zend copyright name 2026-04-11 21:20:54 -05:00
NEWS ext/sockets: Fix socket_recvmsg() error state and EAGAIN warning 2026-12-04 13:18:24 +00:00
php.ini-development Merge branch 'PHP-8.6' 2026-11-26 16:50:38 +01:00
php.ini-production Merge branch 'PHP-8.6' 2026-11-26 16:50:38 +01:00
README.md Run tests in parallel by default (#22939) 2026-08-10 11:33:43 +02:00
README.REDIST.BINS Add ext/uri skeleton along with uriparser (#18658) 2025-05-27 08:16:24 +02:00
run-extra-tests.php license-update: run-tests.php source headers 2026-04-11 21:20:54 -05:00
run-tests.php Merge branch 'PHP-8.6' 2026-11-18 16:44:35 +01:00
SECURITY.md [skip ci] Add more rejected examples in SECURITY.md (#23608) 2026-09-08 20:29:57 +02:00
UPGRADING ext/sockets: Fix socket_recvmsg() error state and EAGAIN warning 2026-12-04 13:18:24 +00:00
UPGRADING.INTERNALS SAPI: Convert sapi_getenv to zend_string (#23386) 2026-12-01 12:17:52 -04:00

The PHP Interpreter

PHP is a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

PHP is distributed under the Modified BSD License (SPDX-License-Identifier: BSD-3-Clause).

Test Fuzzing Status

Documentation

The PHP manual is available at php.net/docs.

Installation

Prebuilt packages and binaries

Prebuilt packages and binaries can be used to get up and running fast with PHP.

For Windows, the PHP binaries can be obtained from windows.php.net. After extracting the archive the *.exe files are ready to use.

For other systems, see the installation chapter.

Building PHP source code

For Windows, see Build your own PHP on Windows.

For a minimal PHP build from Git, you will need autoconf, bison, and re2c. For a default build, you will additionally need libxml2 and libsqlite3.

On Ubuntu, you can install these using:

sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev

On Fedora, you can install these using:

sudo dnf install re2c bison autoconf make ccache libxml2-devel sqlite-devel

On MacOS, you can install these using brew:

brew install autoconf bison re2c libiconv libxml2 sqlite

or with MacPorts:

sudo port install autoconf bison re2c libiconv libxml2 sqlite3

Generate configure:

./buildconf

Configure your build. --enable-debug is recommended for development, see ./configure --help for a full list of options.

# For development
./configure --enable-debug
# For production
./configure

Build PHP. To speed up the build, specify the maximum number of jobs using the -j argument:

make -j4

The number of jobs should usually match the number of available cores, which can be determined using nproc.

Testing PHP source code

PHP ships with an extensive test suite, the command make test is used after successful compilation of the sources to run this test suite.

Tests run in parallel by default, using up to 10 detected logical processors. Set -jN in TEST_PHP_ARGS or TESTS to override the worker count:

make TEST_PHP_ARGS=-j4 test

This runs make test with a maximum of 4 concurrent jobs. Alternatively, use -j1 to run tests sequentially.

Use the TEST_PHP_ARGS or TESTS variable to test only specific directories:

make TESTS=tests/lang/ test

The qa.php.net site provides more detailed info about testing and quality assurance.

Installing PHP built from source

After a successful build (and test), PHP may be installed with:

make install

Depending on your permissions and prefix, make install may need superuser permissions.

PHP extensions

Extensions provide additional functionality on top of PHP. PHP consists of many essential bundled extensions. Additional extensions can be found on the PIE Extensions list, and installed with 🥧 PIE, the PHP Installer for Extensions or the deprecated PHP Extension Community Library - PECL.

Contributing

The PHP source code is located in the Git repository at github.com/php/php-src. Contributions are most welcome by forking the repository and sending a pull request.

Discussions are done on GitHub, but depending on the topic can also be relayed to the official PHP developer mailing list internals@lists.php.net.

New features require an RFC and must be accepted by the developers. See Request for comments - RFC and Voting on PHP features for more information on the process.

Bug fixes don't require an RFC. If the bug has a GitHub issue, reference it in the commit message using GH-NNNNNN. Use #NNNNNN for tickets in the old bugs.php.net bug tracker.

Fix GH-7815: php_uname doesn't recognise latest Windows versions
Fix #55371: get_magic_quotes_gpc() throws deprecation warning

See Git workflow for details on how pull requests are merged.

Guidelines for contributors

See further documents in the repository for more information on how to contribute:

Credits

For the list of people who've put work into PHP, please see the PHP credits page.