Per the App Configuration documentation, build.image is the builder option to skip the building process by specifying an image that has already been built.
[build]
image = "flyio/hellofly:latest"
So, in your configuration, Fly is ignoring your application entirely and deploying flyio/hellofly:latest which is the source of the “Hello from Fly” message you’re seeing.
I haven’t used the buildpacks before, but as I understand it from the documentation, your configuration is almost correct. The changes that are required are:
Remove the build.image
Select a php buildpack
Select a builder that is compatible with the php buildpack
I found paketo-buildpacks/php, which says in the README that it’s compatible with 2 builders: paketobuildpacks/builder-jammy-full and paketobuildpacks/builder:full. Unfortunately, PHP 7.4 is at end of life, so it’s not supported by either of these builders: you’ll need to upgrade your app to PHP 8 if you wish to use these builders. The good news is, based on a quick scan of your code; there’s no reason you need PHP 7.4, so if you modify your composer.json to allow for PHP 8, it should work fine:
"require": {
- "php": "7.4.*",
+ "php": "~8",
Run composer update php to apply those changes to your composer.lock. Then you can update your fly.toml to use the correct builder and buildpack:
Thanks @shrink. It was a really good starting point.
Do you know how I can enable php-extensions in the buildpack? One of my dependencies has some dependencies that is not satisfied.
Paketo Buildpack for Composer Install 0.2.0
Executing build process
Building new layer /layers/paketo-buildpacks_composer-install/composer-packages
Running 'composer install'
exit status 2
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- kigkonsult/icalcreator is locked to version v2.41.71 and an update of this package was not requested.
- kigkonsult/icalcreator v2.41.71 requires ext-zlib * -> it is missing from your system. Install or enable PHP's zlib extension.
To enable extensions, verify that they are enabled in your .ini files:
- /layers/paketo-buildpacks_composer-install/composer-php-ini/composer-php.ini
- /layers/paketo-buildpacks_php-dist/php/etc/buildpack.ini
- /layers/paketo-buildpacks_php-dist/php/etc/php.ini
- /layers/paketo-buildpacks_php-dist/php/etc/buildpack.ini
- /layers/paketo-buildpacks_php-dist/php/etc/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-zlib` to temporarily ignore these required extensions.
ERROR: failed to build: exit status 1
Error failed to fetch an image or build from source: executing lifecycle: failed with status code: 51
Reviewing the documentation, it looks like, unfortunately, zlib isn’t supported within this buildpack and there is no option to install custom extensions. The package you depend on (kigkonsult/icalcreator) didn’t introduce the dependency on zlib until version 2.41.39 (earlier this year), so you could downgrade to 2.41.30. Alternatively, you could bypass the dependency check and cross your fingers that the code you’re relying on doesn’t actually need zlib: I couldn’t find any apparent reason it would be required… to do that you could add the build argument suggested in the error message, e.g:
If downgrading to version 2.41.30 isn’t an option, and ignoring the dependency on zlib isn’t an option, then I think (without experience of buildpacks) the next best option would be to use your own Dockerfile instead of relying on a buildpack. If you don’t have Docker experience, that might be a painful switch but it would be straight forward if you know what you’re doing with Docker
I downgraded the dependency and was able to get it built now.
However, I keep getting this error, which I suppose is openssl not properly setup.
PHP Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /workspace/index.php on line 129
According to this comment on GitHub the openssl extension is not automatically available through the composer require behaviour due to an issue that is yet to be fixed. However, according to this issue there is a workaround whereby you create your own .ini file and enable the extension there:
diff --git a/.php.ini.d/extension.ini b/.php.ini.d/extension.ini
new file mode 100644
index 0000000..cb58b9c
--- /dev/null
+++ b/.php.ini.d/extension.ini
@@ -0,0 +1 @@
+extension=openssl.so
I ran a quick test and it seems to work – /calendar/proxy/vih loads, no error!