核心配置选项列表
下面是 PHP 的 configure
脚本使用的部分选项的列表,用于类 Unix
环境的编译。大部分配置选项在扩展模块参考页面适当的位置列出,而不是在这里。要查看所有可用配置选项的列表,在运行
autoconf 命令后在 PHP 的源代码目录运行
./configure --help(参见安装与配置一章)。也可以阅读
» GNU configure
文档以获得有关 configure
命令的更详细信息,例如 --prefix=PREFIX
。
注意:
这些选项只用在编译的时候。如果想要修改 PHP 的运行时配置,请阅读运行时配置。
PHP 配置选项
杂项选项
- --enable-debug
-
编译时加入调试符号。
- --with-layout=TYPE
-
设置被安装文件的布局。TYPE 是 PHP(默认)或 GNU。
- --with-pear=DIR
-
在 DIR(默认为 PREFIX/lib/php)中安装 PEAR。
- --without-pear
-
不安装 PEAR。
- --enable-sigchild
-
使用 PHP 自带的 SIGCHLD 处理器。
- --disable-rpath
-
禁用在搜索路径中传递其他运行库。
- --enable-libgcc
-
启用 libgcc 的精确链接。
- --enable-php-streams
-
包含试验性的 PHP 流。不要使用此选项,除非是要测试代码!
- --with-zlib-dir[=DIR]
-
定义 zlib 的安装目录。
- --with-tsrm-pthreads
-
使用 POSIX 线程(默认)。
-
编译共享库 [default=yes]。
- --enable-static[=PKGS]
-
编译静态库 [default=yes]。
- --enable-fast-install[=PKGS]
-
为快速安装优化 [default=yes]。
- --with-gnu-ld
-
假设 C 编译器使用 GNU ld [default=no]。
- --disable-libtool-lock
-
避免锁死(可能破坏并联的编译)。
- --with-pic
-
尝试仅使用 PIC/非 PIC 对象 [default=use both]。
- --enable-versioning
-
仅导出必须的符号。查看 INSTALL 文件以获得更多信息。
PHP 选项
- --enable-maintainer-mode
-
对偶然安装一下的情形启用此选项,使得不检查编译规则和依赖关系。
- --with-config-file-path=PATH
-
设置 php.ini 的搜索路径。默认为 PREFIX/lib。
- --enable-safe-mode
-
默认启用安全模式。
警告本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
- --with-exec-dir[=DIR]
-
在安全模式时仅允许在 DIR 目录中执行。默认目录为 /usr/local/php/bin。
警告本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
- --enable-magic-quotes
-
默认启用 magic quotes。
警告本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
-
默认禁用短形式的开始标签 <? 。
- --enable-zend-multibyte
-
在词法与语法分析时允许多字节编码被执行。如果在编译 PHP 时使用了这个选项,就能够在 declare 结构中使用 encoding 指令。
警告本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
- --with-libdir
-
指定Uxin系统库文件目录用于构建 PHP。 对于64位系统, 需要指定
lib64
目录,比如--with-libdir=lib64
。
SAPI 选项
下面的列表包含 PHP 可用的 SAPI(服务器应用编程接口
)。
- --with-apxs[=FILE]
-
编译共享的 Apache 模块。FILE 是可选的 Apache apxs 工具的路径,默认指向 apxs。请确认指定的 apxs 已经安装在服务器中,并且它不是 Apache 源码包中的那个 apxs。
- --with-apache[=DIR]
-
编译静态 Apache 模块。DIR 是 Apache 编译目录的顶层,默认为 /usr/local/apache。
- --with-mod_charset
-
启用 mod_charset 的转换表(俄文的 Apache 使用)。
- --with-apxs2[=FILE]
-
编译共享的 Apache 2.0 模块。FILE 是可选的 Apache apxs 工具的路径,默认指向 apxs。
- --disable-cli
-
禁止编译 PHP 的 CLI 版本(使用它将同时强制使用 --without-pear 选项)。更多信息请参阅 PHP 的命令行模式。
- --enable-phpdbg
-
启用 phpdbg 调试 SAPI 模块支持。
- --enable-embed[=TYPE]
-
启用编译嵌入的 SAPI 库。TYPE 或者为
shared
或者为static
,默认为shared
。 - --with-servlet[=DIR]
-
包含 servlet 支持。DIR 是 JSDK 的安装目录。此 SAPI 要求 java 扩展必须作为共享模块编译到 PHP 中。
- --disable-cgi
-
禁止编译 CGI 版本的 PHP。
这个选项也会启用 FastCGI。

User Contributed Notes 2 notes
i'll answer myself (FINALLY!)
current "configure options" can be viewed with "php-config" shell script, aside with other compile time options too =D!!! ...
in some distributions it comes with the "php-devel" package... but until in this online manual "php-config" is mentioned in pecl extensions documentation (i couldn't find on pecl site), idk if that "php-devel" has something to do with this
... however i noticed they are literal strings inside the script, i hope the script itself were built together with php compilation o_O
in the previous page "configure options" (link shown above ^), there is an editor note with additional info about it
please somebody tell me how to display configure options used in php actual binary
it was shown in phpinfo() some years before, it was very useful, specially with 'phpize' recompilation and to enable some pecl/pear module :/
please tell me also which ctriteria had php guys used to suddenly decided to hide (or obfuscate) this info :/
thanks in advance