php - 如何将配置选项传递给 phpenv install

标签 php

我想通过 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 codethe man files揭示以下内容:

ENVIRONMENT

  • PHP_BUILD_DEBUG, set this to yes to trigger a set -x call. This echo's all issued shell commands of the script.
  • PHP_BUILD_XDEBUG_ENABLE=on|off (default: on), set to off to comment out the lines which enable XDebug, in the generated xdebug.ini.
  • PHP_BUILD_CONFIGURE_OPTS, list of additional configure options.
  • PHP_BUILD_ZTS_ENABLE=on|off (default: off), enables Zend Thread Safety for builds
  • PHP_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/

相关文章:

php - 在 windows 上安装 phpunit

php - 将 php 处理程序附加到 MySQL 的正确语法是什么?

php - 将 php 变量传递给 google.maps javascript 方法

php - array_key_exist() 以数组为键

php - 多个指标上的相同聚合Elasticsearch

PHP 从 PostgreSQL 查询中获取结果字符串

javascript - 在 codeigniter 的单个复选框中插入多条记录?

javascript - 弹出成功并淡出 AJAX 成功

php - 间隔 30 分钟的循环时间字符串

javascript - 单击提交按钮后jquery显示警报