<i id='rrLUt'><tr id='rrLUt'><dt id='rrLUt'><q id='rrLUt'><span id='rrLUt'><b id='rrLUt'><form id='rrLUt'><ins id='rrLUt'></ins><ul id='rrLUt'></ul><sub id='rrLUt'></sub></form><legend id='rrLUt'></legend><bdo id='rrLUt'><pre id='rrLUt'><center id='rrLUt'></center></pre></bdo></b><th id='rrLUt'></th></span></q></dt></tr></i><div id='rrLUt'><tfoot id='rrLUt'></tfoot><dl id='rrLUt'><fieldset id='rrLUt'></fieldset></dl></div>
<tfoot id='rrLUt'></tfoot>
  • <legend id='rrLUt'><style id='rrLUt'><dir id='rrLUt'><q id='rrLUt'></q></dir></style></legend>

      1. <small id='rrLUt'></small><noframes id='rrLUt'>

        • <bdo id='rrLUt'></bdo><ul id='rrLUt'></ul>
      2. 对一个命令使用不同的 PHP 版本 CLI 可执行文件

        Use different PHP version CLI executable for one command(对一个命令使用不同的 PHP 版本 CLI 可执行文件)
        • <bdo id='PFOvO'></bdo><ul id='PFOvO'></ul>

            <tbody id='PFOvO'></tbody>
              <tfoot id='PFOvO'></tfoot>

                <small id='PFOvO'></small><noframes id='PFOvO'>

                <i id='PFOvO'><tr id='PFOvO'><dt id='PFOvO'><q id='PFOvO'><span id='PFOvO'><b id='PFOvO'><form id='PFOvO'><ins id='PFOvO'></ins><ul id='PFOvO'></ul><sub id='PFOvO'></sub></form><legend id='PFOvO'></legend><bdo id='PFOvO'><pre id='PFOvO'><center id='PFOvO'></center></pre></bdo></b><th id='PFOvO'></th></span></q></dt></tr></i><div id='PFOvO'><tfoot id='PFOvO'></tfoot><dl id='PFOvO'><fieldset id='PFOvO'></fieldset></dl></div>

                  <legend id='PFOvO'><style id='PFOvO'><dir id='PFOvO'><q id='PFOvO'></q></dir></style></legend>
                  本文介绍了对一个命令使用不同的 PHP 版本 CLI 可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我安装了三个 PHP 版本的 Gentoo 盒子(没关系):

                  So I have Gentoo box with three PHP versions installed (nevermind the reasons):

                  1. /usr/bin/php -> /usr/lib64/php5.4/bin/php
                  2. /usr/bin/php5.5 -> /usr/lib64/php5.5/bin/php
                  3. /usr/bin/php5.6 -> /usr/lib64/php5.4/bin/php
                  1. /usr/bin/php -> /usr/lib64/php5.4/bin/php
                  2. /usr/bin/php5.5 -> /usr/lib64/php5.5/bin/php
                  3. /usr/bin/php5.6 -> /usr/lib64/php5.4/bin/php

                  我想使用 composer 安装 Laravel 框架:

                  I want to install Laravel framework using composer:

                  $ composer create-project laravel/laravel --prefer-dist
                  

                  这会引发错误,因为 Laravel 需要 PHP > 5.5.9 并且默认的 php 解释器是 5.4.所以我发出另一个命令:

                  This however throws an error because Laravel requires PHP > 5.5.9 and the default php interpreter is 5.4. So I issue another command:

                  $ /usr/bin/php5.6 /usr/bin/composer create-project laravel/laravel --prefer-dist
                  

                  这让我更进一步,但随后来自 Laravel 的 composer.json 的一些安装后命令开始发挥作用,导致安装崩溃.

                  This takes me one step further, but then some post-install commands from Laravel's composer.json comes into play, and installation crashes.

                  这是因为 composer.json 命令看起来像这样:

                  This is due to the fact, that composer.json commands look like this:

                  "post-install-cmd": [
                      "php artisan clear-compiled",
                      "php artisan optimize"
                  ],
                  

                  如您所见,默认"解释器又被使用了!

                  As you can see, the "default" interpreter is used again!

                  现在,正确的 PHP 文件以以下 shebang 开头:

                  Now, proper PHP files start with following shebang:

                  #!/usr/bin/env php
                  

                  这是一个不错的功能,因为 PHP 解释器可以在不同系统的不同位置找到.不幸的是,在这种情况下 env 命令返回它在 $PATH 环境变量中找到的第一个可执行文件的路径.

                  This is nice feature as PHP interpreter can be found under different locations on different systems. Unfortunatelly, in this case env command returns path to the first executable it finds in $PATH environmental variable.

                  我怎么可能改变当前会话环境或执行什么样的技巧来执行整个 Laravel 安装过程 php 命令将调用 /usr/bin/php5.6 而不是 /usr/bin/php?

                  How could I possibly alter current session environment or what kind of trick to perform so for the execution of whole Laravel installation process php command would invoke /usr/bin/php5.6 instead of /usr/bin/php?

                  我不想更改 $PATH 变量或修改 composercomposer.json 或 Laravel 的 CLI 实用程序 等文件工匠.

                  I don't want to change $PATH variable or modify files like composer, composer.json or Laravel's CLI utility artisan.

                  还假设我想从普通用户帐户执行此操作(即没有 root 权限).

                  also assume that I want to do this from regular user account (i.e. with no root permissions).

                  推荐答案

                  也许你可以尝试修复环境!

                  Maybe you can try to fix the environnement!

                  $ php -v
                  PHP 5.4.x (cli) ...
                  $ set PATH="/usr/lib64/php5.6/bin:$PATH"
                  $ php -v
                  PHP 5.6.x (cli) ...
                  

                  或者,如果您不想修改 shell 会话的 PATH,您可以仅针对当前命令进行更改:

                  Or, if you don't want to modify the PATH for your shell session, you can scope the change for the current command only:

                  $ php -v
                  PHP 5.4.x (cli) ...
                  $ env PATH="/usr/lib64/php5.6/bin:$PATH" php -v
                  PHP 5.6.x (cli) ...
                  $ php -v
                  PHP 5.4.x (cli) ...
                  

                  这篇关于对一个命令使用不同的 PHP 版本 CLI 可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='KkHSh'></bdo><ul id='KkHSh'></ul>
                      <tfoot id='KkHSh'></tfoot>

                        <legend id='KkHSh'><style id='KkHSh'><dir id='KkHSh'><q id='KkHSh'></q></dir></style></legend>
                          • <i id='KkHSh'><tr id='KkHSh'><dt id='KkHSh'><q id='KkHSh'><span id='KkHSh'><b id='KkHSh'><form id='KkHSh'><ins id='KkHSh'></ins><ul id='KkHSh'></ul><sub id='KkHSh'></sub></form><legend id='KkHSh'></legend><bdo id='KkHSh'><pre id='KkHSh'><center id='KkHSh'></center></pre></bdo></b><th id='KkHSh'></th></span></q></dt></tr></i><div id='KkHSh'><tfoot id='KkHSh'></tfoot><dl id='KkHSh'><fieldset id='KkHSh'></fieldset></dl></div>
                              <tbody id='KkHSh'></tbody>
                          • <small id='KkHSh'></small><noframes id='KkHSh'>