php-src README

The project's README from github.com/php/php-src. As one markdown file: README.md.

PHP

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 [email protected].

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.

php-src (php/php-src)

Searching Database…

40.4K ·GitHub
这是什么?这是 PHP 的源代码。PHP 是一种流行的通用脚本语言,特别适合 Web 开发——这个仓库里是用 C 语言写成的 PHP 解释器本身。
运行 PHP 应用装的是这个,还是这门语言背后的源代码?这是解释器本身,不是引入到项目里的框架或库。普通用户一般安装预编译好的安装包即可;这个仓库是给你自己编译 PHP 或参与开发用的。
怎么用这个仓库弄出一个能用的 PHP?在 Windows 上,从 windows.php.net 下载二进制文件并解压——里面的 .exe 文件拿来就能用。其他平台则从源码构建:先生成 configure 脚本,运行 ./configure,再用 make -j 编译,任务数和你电脑的 CPU 核心数一致即可。
自己编译安装时有什么要注意的坑?根据你设置的安装前缀,make install 可能需要管理员(超级用户)权限。如果你打算开发 PHP 本身,请在 configure 时加上 --enable-debug;运行 ./configure --help 可以看到全部选项。
PHP 可以免费使用吗?商用也行吗?可以。PHP 采用 Modified BSD License(BSD-3-Clause)发布,这是一种宽松的开源许可证,把它用在商业产品里没有任何实际限制。
写 PHP 需要懂 C 吗?不需要。你写的应用程序用的是 PHP 语言本身;这个仓库里的 C 代码只有在你想要编译或修改解释器时才用得上。如果只是运行 PHP,一个预编译包就够了。
这门语言还在不断更新吗?是的。新功能要经过公开的 RFC 流程,并且必须得到开发者社区的认可才会加入;漏洞修复则直接通过拉取请求(pull request)合入,同时每晚运行的 CI 会持续检查有没有出现回退问题。
What are similar projects?ruby, lua, cpython, craftinginterpreters, mquickjs, c4, ArcadeMaker, bend
Creator
php
Size
651 MB
Stars
40.4K
Age
15y
Commits · 90 Days