我想通过 phpenv 安装 PHP启用 ZTS 和调试符号。在手动安装中,我会通过传递 --enable-debug
and --enable-maintainer-zts
来完成此操作到配置选项。
如何将这些选项传递给 phpenv?
最佳答案
键入 phpenv install --help
打印
Usage: phpenv install [--ini|-i <environment>] <version>
phpenv install [--ini|-i <environment>] <definition-file>
phpenv install -l|--list
phpenv install -V|--version
-l/--list List all available versions
-V/--version Show version of php-build
For detailed information on installing PHP versions with
php-build, including a list of environment variables for adjusting
compilation, see: https://github.com/php-build/php-build
所以没有命令行标志来传递这些选项。但最后一段重定向到 https://github.com/php-build/php-build ,这是 phpenv 用来安装 php 的。该 repo 协议(protocol)中的自述文件没有列出任何环境变量,而是深入研究了 source code和 the man files揭示以下内容:
ENVIRONMENT
PHP_BUILD_DEBUG
, set this toyes
to trigger aset -x
call. This echo's all issued shell commands of the script.PHP_BUILD_XDEBUG_ENABLE=on|off
(default:on
), set tooff
to comment out the lines which enable XDebug, in the generatedxdebug.ini
.PHP_BUILD_CONFIGURE_OPTS
, list of additional configure options.PHP_BUILD_ZTS_ENABLE=on|off
(default:off
), enables Zend Thread Safety for buildsPHP_BUILD_INSTALL_EXTENSION
see [EXTENSION] section.
因此要使用 ZTS 和 Debug模式安装 PHP,需要使用
PHP_BUILD_ZTS_ENABLE=yes \
PHP_BUILD_CONFIGURE_OPTS="--enable-debug" \
phpenv install 7.1.0
关于php - 如何将配置选项传递给 phpenv install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42808399/