尝试使用 LARAVEL Ver 5.3 和 PHP 7.0 将应用程序推送到 Bluemix 时出错

Error while trying to push app into Bluemix with LARAVEL Ver 5.3 and PHP 7.0

尝试将应用程序推送到 Bluemix 时遇到此错误 LARAVEL 版本 5.3 和 PHP 7.0

无法将您的要求解析为一组可安装的软件包。

Problem 1
    - This package requires 
php
>=5.6.4 but your PHP version (5.5.38) does not satisfy that requirement.

Problem 2
    - laravel/framework v5.3.23 requires php >=5.6.4 -> your PHP version (5.5.38) does not satisfy that requirement.
    - laravel/framework v5.3.23 requires php >=5.6.4 -> your PHP version (5.5.38) does not satisfy that requirement.

附上暂存的完整输出:

   Updated app with guid 99128c49-c374-407b-940d-c8842d8419f9 ({"buildpack"=>"https://github.com/cloudfoundry/php-buildpack", "name"=>"*****", "command"=>"PRIVATE DATA HIDDEN", "instances"=>1, "memory"=>512, "environment_json"=>"PRIVATE DATA HIDDEN"})

    Updated app with guid 99128c49-c374-407b-940d-c8842d8419f9 ({"route"=>"d5d0cb3b-d428-4297-823d-8bfebd318b98"})

    Updated app with guid 99128c49-c374-407b-940d-c8842d8419f9 ({"console"=>true, "state"=>"STOPPED"})

    Got staging request for app with id 99128c49-c374-407b-940d-c8842d8419f9
    Updated app with guid 99128c49-c374-407b-940d-c8842d8419f9 ({"console"=>true, "state"=>"STARTED"})

    -----> Downloaded app package (132M)
    Cloning into '/tmp/buildpacks/php-buildpack'...
    Cloning into 'compile-extensions'...
    Submodule path 'compile-extensions': checked out '6fc96370a0c95fb3ac22d47a4436152a38bed540'
    -------> Buildpack version 4.3.24
    Installing HTTPD
    HTTPD 2.4.23
    Downloaded [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/httpd/httpd-2.4.23-linux-x64.tgz] to [/tmp]
    Installing PHP
    PHP 5.5.38
    Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php-5.5.38-linux-x64-1479852231.tgz] to [/tmp]
    The extension 'tokenizer' is not provided by this buildpack.
    The extension 'dom' is not provided by this 
    buildpack
    .
    The extension '
    json
    ' is not provided by this 
    buildpack
    .
    The extension '
    libxml
    ' is not provided by this 
    buildpack
    .
    The extension '
    xml
    ' is not provided by this 
    buildpack
    .
    Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php-5.5.38-linux-x64-1479852231.tgz] to [/tmp]
    Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/binaries/trusty/composer/1.2.4/composer.phar] to [/tmp]
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed

      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100   283  100   283    0     0    215      0  0:00:01  0:00:01 --:--:--   215
    Loading composer repositories with package information
    Installing dependencies from lock file

    Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.

    Your requirements could not be resolved to an installable set of packages.

    Problem 1
        - This package requires 
    php
    >=5.6.4 but your PHP version (5.5.38) does not satisfy that requirement.

    Problem 2
        - laravel/framework v5.3.23 requires php >=5.6.4 -> your PHP version (5.5.38) does not satisfy that requirement.
        - laravel/framework v5.3.23 requires php >=5.6.4 -> your PHP version (5.5.38) does not satisfy that requirement.
        - Installation request for laravel/framework v5.3.23 -> satisfiable by laravel/framework[v5.3.23].
    Traceback (most recent call last):
    -----> Composer command failed


        File "/tmp/buildpacks/php-buildpack/scripts/compile.py", line 50, in <module>
            .from_build_pack('lib/additional_commands')
          File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/builder.py", line 208, in extensions
            process_extension(path, ctx, 'compile', process, args=[self])
          File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/utils.py", line 69, in process_extension
            success(getattr(extn, to_call)(*args))
          File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 425, in compile
            return composer.compile(install)
          File "/tmp/buildpacks/php-buildpack/lib/extension_helpers.py", line 154, in compile
            self._compile(install)
          File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 192, in _compile
            self.run()
          File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 327, in run
            *self._ctx['COMPOSER_INSTALL_OPTIONS'])
          File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 371, in run
            shell=True)
          File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/runner.py", line 109, in stream_output
            raise CalledProcessError(retcode, cmd)
        build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7f53abf406f0>' returned non-zero exit status 2
        Staging failed: Buildpack compilation step failed
        encountered error: App staging failed in the buildpack compile phase

在 options.json 中,尝试使用最新版本的 PHP 7.0,它仍然选择 5.5.38 版本。

另外,也尝试了 运行 composer 在本地更新。

是buildpack级别的问题吗?

任何解决方法?

在 options.json 文件中声明使用 PHP 7.0 最新版本时,您是否忘记包含 curly 括号 {}?

"PHP_VERSION": "{PHP_70_LATEST}"

调试指导

  • Buildpack:设置一个 Cloud Foundry ENV VAR BP_DEBUG: true 和 restage
  • Laravel PHP 应用程序:设置 Cloud Foundry ENV VAR APP_DEBUG: true 并重新暂存。当您点击应用程序的 url 时,您将获得堆栈跟踪信息。

框架Laravel Bluemix 应用程序

您可以找到具有 Laravel 5.3 代码库的骨架存储库,该代码库对 Bluemix 友好并使用 PHP 7.x here.

进行部署

要部署,只需

git clone https://github.com/ibmjstart/Bluemix-Laravel-Demo
cd Bluemix-Laravel-Demo
cf push

希望这会有助于说明让您入门的机制。