在 Cloudfoundry 上部署 Laravel 应用程序
Deploy a Laravel App on Cloudfoundry
我正在尝试将基于 Laravel 的 Web 应用程序部署到 Swisscom 应用程序云。因此,我使用提供的 PHP Buildpack。文档显示了 Lumen 的示例,因此我假设它也应该与 Laravel 一起使用。
使用的命令:cf push app-name -m 512M -n app-name
部署时出现以下两个错误:
一)
The extension 'fpm' is not provided by this buildpack.
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 'pcre' is not provided by this buildpack.
The extension 'reflection' is not provided by this buildpack.
The extension 'spl' is not provided by this buildpack.
b)
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Warning: require(/tmp/app/bootstrap/../vendor/autoload.php):failed to open stream: No such file or directory in /tmp/app/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/tmp/app/bootstrap/../vendor/autoload.php'(include_path='../lib/php:/tmp/app/lib') in /tmp/app/bootstrap/autoload.php on line 17
Script php artisan optimize handling the post-install-cmd event returned with an error
我的 options.json
文件:
{
"WEBDIR": "public",
"PHP_VERSION": "{PHP_70_LATEST}",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "pdo_mysql"]
}
感谢您的帮助!
a => 与 buildpack 相关,不会破坏任何东西。这只是这些扩展程序尚不可用的信息。
b => artisan 在暂存时不可用,因此您在作曲家脚本 (composer.json) 中触发的 "optimize" 命令将不起作用。目前还没有找到合适的解决办法,所以暂时不做。
你的 options.json 还需要一件事 => "LIBDIR": ""
这将在应用程序根目录中安装您的作曲家供应商目录。
此致
戴夫
我找到了解决办法。只需添加
"COMPOSER_VENDOR_DIR": "vendor",
到您的 options.json
文件。
{
"PHP_VERSION": "{PHP_70_LATEST}",
"WEBDIR": "public",
"LIBDIR": "vendor",
"COMPOSER_VENDOR_DIR": "vendor",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "pdo_mysql"]
}
我正在尝试将基于 Laravel 的 Web 应用程序部署到 Swisscom 应用程序云。因此,我使用提供的 PHP Buildpack。文档显示了 Lumen 的示例,因此我假设它也应该与 Laravel 一起使用。
使用的命令:cf push app-name -m 512M -n app-name
部署时出现以下两个错误:
一)
The extension 'fpm' is not provided by this buildpack.
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 'pcre' is not provided by this buildpack.
The extension 'reflection' is not provided by this buildpack.
The extension 'spl' is not provided by this buildpack.
b)
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Warning: require(/tmp/app/bootstrap/../vendor/autoload.php):failed to open stream: No such file or directory in /tmp/app/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/tmp/app/bootstrap/../vendor/autoload.php'(include_path='../lib/php:/tmp/app/lib') in /tmp/app/bootstrap/autoload.php on line 17
Script php artisan optimize handling the post-install-cmd event returned with an error
我的 options.json
文件:
{
"WEBDIR": "public",
"PHP_VERSION": "{PHP_70_LATEST}",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "pdo_mysql"]
}
感谢您的帮助!
a => 与 buildpack 相关,不会破坏任何东西。这只是这些扩展程序尚不可用的信息。
b => artisan 在暂存时不可用,因此您在作曲家脚本 (composer.json) 中触发的 "optimize" 命令将不起作用。目前还没有找到合适的解决办法,所以暂时不做。
你的 options.json 还需要一件事 => "LIBDIR": "" 这将在应用程序根目录中安装您的作曲家供应商目录。
此致 戴夫
我找到了解决办法。只需添加
"COMPOSER_VENDOR_DIR": "vendor",
到您的 options.json
文件。
{
"PHP_VERSION": "{PHP_70_LATEST}",
"WEBDIR": "public",
"LIBDIR": "vendor",
"COMPOSER_VENDOR_DIR": "vendor",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "pdo_mysql"]
}