问题
I am trying to deploy a Laravel based web application to the Swisscom Application Cloud. Therefor I use the provided PHP Buildpack. The Docs shows an example with Lumen, so I am assuming that it should work with Laravel as well.
Used command: cf push app-name -m 512M -n app-name
While deploying I get these two errors:
a)
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
My options.json
file:
{
"WEBDIR": "public",
"PHP_VERSION": "{PHP_70_LATEST}",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "pdo_mysql"]
}
Thank you for your help!
回答1:
a => is buildpack related and doesn't break anything. It's just an information that these extension aren't available yet.
b => artisan isn't available at staging time so the "optimize" command you are triggering in your composer scripts (composer.json) won't work. I didn't found a proper solution yet, so currently I don't do this.
Your options.json need one more thing => "LIBDIR": "" This will install your composer vendor directory in the app root.
Best regards Dave
回答2:
I've found the solution. Simply add
"COMPOSER_VENDOR_DIR": "vendor",
to your options.json
file.
{
"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"]
}
More information in the Docs
来源:https://stackoverflow.com/questions/38097591/deploy-a-laravel-app-on-cloudfoundry