php / php-src
php / php-src
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).
PHP 解释器 PHP 是一种流行的通用脚本语言,特别适合 Web 开发。PHP 快速、灵活且务实,为从您的博客到世界上最受欢迎的网站等一切内容提供支持。PHP 根据修改后的 BSD 许可证(SPDX-License-Identifier: BSD-3-Clause)分发。
Documentation The PHP manual is available at php.net/docs.
文档 PHP 手册可在 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.
安装 预构建包和二进制文件 可以使用预构建包和二进制文件来快速启动并运行 PHP。对于 Windows,可以从 windows.php.net 获取 PHP 二进制文件。解压归档文件后,*.exe 文件即可使用。对于其他系统,请参阅安装章节。
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
构建 PHP 源代码 对于 Windows,请参阅“在 Windows 上构建您自己的 PHP”。对于从 Git 进行的最小化 PHP 构建,您需要 autoconf、bison 和 re2c。对于默认构建,您还需要 libxml2 和 libsqlite3。在 Ubuntu 上,您可以使用以下命令安装它们:sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev。在 Fedora 上,您可以使用以下命令安装它们:sudo dnf install re2c bison autoconf make ccache libxml2-devel sqlite-devel。在 MacOS 上,您可以使用 brew 安装它们:brew install autoconf bison re2c libiconv libxml2 sqlite,或者使用 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.
生成配置:./buildconf 配置您的构建。建议在开发时使用 —enable-debug,请参阅 ./configure —help 获取选项的完整列表。# 用于开发 ./configure —enable-debug # 用于生产 ./configure 构建 PHP。为了加快构建速度,请使用 -j 参数指定最大作业数:make -j4。作业数量通常应与可用核心数匹配,这可以使用 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.
测试 PHP 源代码 PHP 附带了一个广泛的测试套件,在成功编译源代码后,使用命令 make test 来运行此测试套件。测试默认并行运行,最多使用 10 个检测到的逻辑处理器。在 TEST_PHP_ARGS 或 TESTS 中设置 -jN 以覆盖工作线程数:make TEST_PHP_ARGS=-j4 test。这会以最多 4 个并发作业运行 make test。或者,使用 -j1 来按顺序运行测试。使用 TEST_PHP_ARGS 或 TESTS 变量仅测试特定目录:make TESTS=tests/lang/ test。qa.php.net 网站提供了有关测试和质量保证的更详细信息。
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 在成功构建(和测试)后,可以使用以下命令安装 PHP:make install。根据您的权限和前缀,make install 可能需要超级用户权限。
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.
PHP 扩展 扩展在 PHP 之上提供了额外的功能。PHP 由许多必要的捆绑扩展组成。其他扩展可以在 PIE 扩展列表中找到,并使用 🥧 PIE(PHP 扩展安装程序)或已弃用的 PHP 扩展社区库 (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.
贡献 PHP 源代码位于 github.com/php/php-src 的 Git 仓库中。非常欢迎通过 fork 仓库并发送拉取请求来进行贡献。讨论在 GitHub 上进行,但根据主题也可以转发到官方 PHP 开发人员邮件列表 internals@lists.php.net。新功能需要 RFC 并必须被开发人员接受。有关该过程的更多信息,请参阅“征求意见 - RFC”和“PHP 功能投票”。错误修复不需要 RFC。如果错误有 GitHub 问题,请在提交消息中使用 GH-NNNNNN 引用它。对于旧的 bugs.php.net 错误跟踪器中的工单,请使用 #NNNNNN。修复 GH-7815:php_uname 无法识别最新的 Windows 版本;修复 #55371:get_magic_quotes_gpc() 抛出弃用警告。有关如何合并拉取请求的详细信息,请参阅 Git 工作流程。
Guidelines for contributors See further documents in the repository for more information on how to contribute: Contributing to PHP PHP coding standards Internal documentation Mailing list rules PHP release process
贡献者指南 有关如何贡献的更多信息,请参阅仓库中的其他文档:为 PHP 做贡献、PHP 编码标准、内部文档、邮件列表规则、PHP 发布流程。
Credits For the list of people who’ve put work into PHP, please see the PHP credits page.
致谢 有关为 PHP 做出贡献的人员名单,请参阅 PHP 致谢页面。