Closed Simbiat closed 2 months ago
@dunglas looks like this is missing a \0
at the end of the env string? The _php<SOH>
is likely some memory right next to the string.
I don't manage to reproduce the issue. Could you please create a repository (or even better, a failing test) containing a minimal reproducer please?
Well, essentially, https://github.com/Simbiat/simbiat.ru
For minimum test, I would guess you will need docker-compose.yml, config folder (includes docker files and caddy.json5 which is the config I use), use something like var_dump($_SERVER);
in /public/index.php
file, and try to go to a page like https://localhost/.htaccess
Cloning Simbiat/simbiat.ru
and running docker compose up
doesn't work:
WARN[0000] The "MARIADB_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "MARIADB_PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "MARIADB_DATA_DIR" variable is not set. Defaulting to a blank string.
WARN[0000] The "MARIADB_KEYS_DIR" variable is not set. Defaulting to a blank string.
WARN[0000] The "MARIADB_BACKUP_DIR" variable is not set. Defaulting to a blank string.
WARN[0000] The "WEB_SERVER_TEST" variable is not set. Defaulting to a blank string.
WARN[0000] The "WEB_SERVER_TEST" variable is not set. Defaulting to a blank string.
WARN[0000] The "CADDY_DATA_DIR" variable is not set. Defaulting to a blank string.
WARN[0000] The "CADDY_CONFIG_DIR" variable is not set. Defaulting to a blank string.
invalid spec: :/var/lib/mysql:rw: empty section between colons
This will be very hard to debug without a minimal, reproducer, ideally not relying on Docker.
Ok, I have an idea of what's the problem.
We currently automatically escape keys only for Caddyfiles: https://github.com/dunglas/frankenphp/blob/main/caddy/caddy.go#L308
I'll try to fix this.
there are example .env files in root, config/frankenphp
and config/mysql
folders. Sorry, I just moved the project to Docker, so have not bothered with a manual, since did not even think someone would need to clone it :D
Not sure about key escaping: while I am using JSON5, it is adapted to JSON using respective plugin. And caddyfile is supposed to be adapted to JSON as well, and in JSON (the atosave.json
) the keys are normal.
I'm working on a fix. As a workaround, you can encode the keys like this:
"env": {
"FOO\u0000": "bar"
},
(add \u0000
after the name of the env var)
Yes, can confirm, that adding \u0000
works. I see a proper fix has also been released now, so I guess it will be included into next release, right? Any ETA for it?
What happened?
Hi. I have setup Caddy to direct all HTTP errors to php handler and set environmenty variable like this:
In JSON relevant part looks like:
It works, but the name of the variable in PHP itself is
CADDY_HTTP_ERROR_php
. I do not mind_php
postfix, but the last symbol (which is apparently Start of Heading) is probably excessive, and erroneous.Build Type
Docker (Debian Bookworm)
Worker Mode
No
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output
No response