Installing from source on Unix and macOS systems

Prerequisite software for compiling:

  • » GNU make
  • A C compiler (as of PHP 8.0.0, C99 compatibility is required; as of PHP 8.4.0, C11 compatibility is required)
  • A web server
  • Any module specific components (such as GD, PDF libs, etc.)

When building directly from Git sources or after custom modifications, these additional tools may be necessary:

  • » autoconf:
    • PHP 7.3 and later: 2.68+
    • PHP 7.2: 2.64+
    • PHP 7.1 and earlier: 2.59+
  • » re2c:
    • PHP 8.3 and later: 1.0.3+
    • PHP 8.2 and earlier: 0.13.4+
  • » bison:
    • PHP 7.4 and later: 3.0.0+
    • PHP 7.3 and earlier: 2.4+ (including Bison 3.x)

The initial PHP setup and configuration process is controlled by the use of the command line options of the configure script. A list of available options along with short explanations can be shown by running ./configure --help. This manual documents the different options separately. The core options can be found in the appendix, while the different extension specific options are described on the reference pages.

After the configuration script was been run, PHP can be built using the make command. The Installation section of the frequently asked questions has further information about how to handle build problems.

注意: Some Unix systems (such as OpenBSD and SELinux) may disallow mapping pages both writable and executable for security reasons, what is called » PaX MPROTECT or » W^X violation protection. This kind of memory mapping is necessary for PCRE's JIT support, so either PHP has to be built without PCRE's JIT support, or the binary has to be whitelisted by any means provided by the system.

注意: Cross-compiling for ARM with the Android toolchain is currently not supported.

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top