I’m working on a project with Symfony 5.3 with PHP 8.0.12. I’ve been developing it on my own computer, it’s working well. I now want to deploy it on a remote container.
However when I start the Symfony built in Webserver I’m getting the following error when accessing any of the defined routes:
issue with server callback error="unable to fetch the response from the backend: malformed MIME header: missing colon: "FROM information_schema.schemata""
In both cases (on my computer and in the container), the server is connecting to a remote PostgreSQL database. The container doesn’t seem to have any problem connecting to the database though, as I can manually connect using the psql command.
I’ve tried reinstalling Symfony (Symfony CLI version v4.26.8), Composer (version 2.1.12), and most PHP libraries but that didn’t change anything.
I have no idea where the problem is. Any help would be greatly appreciated.
Here is my composer.json:
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"composer/package-versions-deprecated": "1.11.99.2",
"doctrine/annotations": "^1.13",
"doctrine/doctrine-bundle": "^2.4",
"doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.9",
"lexik/jwt-authentication-bundle": "^2.13",
"sensio/framework-extra-bundle": "^6.2",
"symfony/apache-pack": "^1.0",
"symfony/dotenv": "5.3.*",
"symfony/flex": "^1.15",
"symfony/framework-bundle": "5.3.*",
"symfony/http-foundation": "5.3.*",
"symfony/ldap": "5.3.*",
"symfony/proxy-manager-bridge": "5.3.*",
"symfony/security-bundle": "5.3.*",
"symfony/stopwatch": "5.3.*",
"symfony/web-profiler-bundle": "5.3.*",
"symfony/property-access": "5.3.*",
"symfony/runtime": "5.3.*",
"symfony/security-csrf": "5.3.*",
"symfony/serializer": "5.3.*",
"symfony/yaml": "5.3.*"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.3.*"
}
},
"require-dev": {
"symfony/maker-bundle": "^1.33"
}
}
4
Answers
I have had this error when using
symfony server:start
with docker inside a php-alpine container. Each time i run migrations or doctrine:schema:update in a fresh installed instance, my symfony local web-server would throw error:issue with server callback error="unable to fetch the response from the backend: malformed MIME header: missing colon: "FROM information_schema.schemata
I solved it by dropping the alpine container and building everything from theFROM ubuntu:20.04
image: i had to install php, drivers and all dependencies too. This did not go well with my production env because the image was above 1GB, meaning it had binaries i did not need in production. From experience the symfony local web-server needs a python environment but am not sure on that.After some days, i stumbled on this git repository: https://github.com/dunglas/symfony-docker. which is recommended from Symfony docs here: Using Docker with Symfony. It uses caddy as the web-server. I learnt from it, tweaked to suit my needs and from then never used symfony local web-server. Its a good project, kudos to Kévin Dunglas and maintainers. The php image is about 200MB. Caddy too is about 40MB. Great for both prod and dev environments.
Please peruse the repo and adopt what you can or everything.
Disclaimer: This is not an answer to your problem/error, but an easy alternative.
I have experienced the same issue running inside docker (ubuntu).
Although I am not entirely sure why this happens I have managed to find a workaround that’s easy:
No idea why this works, but when you run it in docker exactly THIS way everything works just fine and you can open your application at
CONTAINER_IP:8000
.I decided to post this here, since it took me 3 hours to figure it out so hopefully this saves somebody’s time.
My quick solution is to remove new lines from the query in file:
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
method:getListTableMetadataSQL
From
to:
Of course, it comes back after composer install, but this shows source of the problem
Before
After
For me – it was a permission issue of the "var" directory. Also in Docker.
Making the directory writable resolved the issue.