You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just gave a try to the standalone mode from a Symfony application, strictly following the documentation steps.
I properly copied the project to /tmp/my-prepared-app, ran composer install and composer dump-env within it, then created the Dockerfile and built the binary.
However, when running it with ./my-app php-server, it boots, but when I curl -i http://localhost, here's what I get:
HTTP/1.1 200 OKContent-Type: text/html; charset=UTF-8Server: CaddyX-Powered-By: PHP/8.3.2Date: Thu, 25 Jan 2024 11:09:09 GMTContent-Length: 633<br /><b>Warning</b>: require_once(/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3/vendor/autoload_runtime.php): Failed to open stream: No such file or directory in <b>/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3/public/index.php</b> on line <b>7</b><br /><br /><b>Fatal error</b>: Uncaught Error: Failed opening required '/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3/vendor/autoload_runtime.php' (include_path='.:') in /tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3/public/index.php:7Stack trace:#0 {main}thrown in <b>/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3/public/index.php</b> on line <b>7</b><br />
So far I understood that when running ./my-app php-server, the underlying PHP code gets unpacked in a /tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3 directory; however, when I head to it, it doesn't contain any vendor directory (as opposed to /tmp/my-prepared-app for which I double-checked), hence the error.
The docs invites the user to execute the composer install part on the host before creating a Dockerfile, whereas this part is included in the demo's Dockerfile (meaning it will be executed by the container)
So I tried doing this and built the Docker image again, unfortunately without success, even with --no-cache
But I noticed that /tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3 was still the unpack target when running the binary, so I assumed Docker didn't give a shit to the --no-cache directive
What worked was actually to replace my-app by something else when building the binary 🤷 - which indeed resulted in a different unpack target directory.
So, at least it works, except I had to add --no-scripts to the composer line, because some scripts executed PHP code which rely on specific PHP extensions (intl for instance); however PHP extensions are to be installed afterwards 🤔 - how to solve this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello there,
I just gave a try to the standalone mode from a Symfony application, strictly following the documentation steps.
I properly copied the project to
/tmp/my-prepared-app
, rancomposer install
andcomposer dump-env
within it, then created the Dockerfile and built the binary.However, when running it with
./my-app php-server
, it boots, but when Icurl -i http://localhost
, here's what I get:So far I understood that when running
./my-app php-server
, the underlying PHP code gets unpacked in a/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3
directory; however, when I head to it, it doesn't contain anyvendor
directory (as opposed to/tmp/my-prepared-app
for which I double-checked), hence the error.What did I miss? 🤔
(Compiled and ran on an Ubuntu 22.04 server)
Follow-up:
After further investigation, by comparing my own code against https://github.com/dunglas/frankenphp-demo
composer install
part on the host before creating aDockerfile
, whereas this part is included in the demo'sDockerfile
(meaning it will be executed by the container)--no-cache
/tmp/frankenphp_ceeae2d8693f725a855fab941146bcc3
was still the unpack target when running the binary, so I assumed Docker didn't give a shit to the--no-cache
directivemy-app
by something else when building the binary 🤷 - which indeed resulted in a different unpack target directory.So, at least it works, except I had to add
--no-scripts
to the composer line, because some scripts executed PHP code which rely on specific PHP extensions (intl
for instance); however PHP extensions are to be installed afterwards 🤔 - how to solve this?Beta Was this translation helpful? Give feedback.
All reactions