symfony-docker icon indicating copy to clipboard operation
symfony-docker copied to clipboard

Error when installing symfony doctrine

Open cosminsandu opened this issue 3 years ago • 7 comments

On the clean installation run

composer require symfony/orm-pack

docker compose up

the following error appears on CI workflow

"Could not connect to /var/run/php/php-fpm.sock\n"

Check: https://github.com/cosminsandu/symfony-docker/actions/runs/3060906399/jobs/4950397486

cosminsandu avatar Sep 16 '22 09:09 cosminsandu

Ok I was able to reproduce the issue and fix it.

  • First, change your DATABASE_URL to match with your docker service (DATABASE_URL="postgresql://app:!ChangeMe!@database:5432/app?serverVersion=14&charset=utf8"). By default the recipes are configured to work with the SymfonyCLI binary.
  • And then, on my side, it was a problem with the bin/console file that didn't have execution rights (chmod +x bin/console)

I hope this solves your issue

maxhelias avatar Sep 19 '22 09:09 maxhelias

Thanks a lot,

I've updated the DATABASE_URL: https://github.com/cosminsandu/symfony-docker/commit/5a1df42a5e98c6d2eb28ab5bafad860b83a1146b

And the CI run failed with the same error:

"Output": "Could not connect to /var/run/php/php-fpm.sock\n"

https://github.com/cosminsandu/symfony-docker/actions/runs/3081508809/jobs/4980130783

cosminsandu avatar Sep 19 '22 10:09 cosminsandu

Try the second step:

And then, on my side, it was a problem with the bin/console file that didn't have execution rights (chmod +x bin/console)

maxhelias avatar Sep 19 '22 11:09 maxhelias

Shouldn't this problem be fixed in Dockerfile? https://github.com/dunglas/symfony-docker/blob/main/Dockerfile

Actually this is done in Dockerfile line 112 https://github.com/dunglas/symfony-docker/blob/main/Dockerfile#L112

CorneanuC avatar Sep 19 '22 11:09 CorneanuC

This could be the problem because in my case the right was not correct after the installation

maxhelias avatar Sep 19 '22 14:09 maxhelias

I can't close this item since it is not resolved.

cosminsandu avatar Sep 20 '22 07:09 cosminsandu

I have this problem with windows docker containers.

{ "level": "error", "ts": 1663659825.7993906, "logger": "http.log.error", "msg": "dialing backend: dial unix /var/run/php/php-fpm.sock: connect: no such file or directory", "request": { "remote_ip": "172.18.0.1", "remote_port": "43622", "proto": "HTTP/2.0", "method": "GET", "host": "localhost", "uri": "/zip", "headers": { "Sec-Fetch-Dest": [ "document" ], "Accept-Language": [ "en-US,en;q=0.9" ], "Accept": [ "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9" ], "User-Agent": [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" ], "Sec-Fetch-Mode": [ "navigate" ], "Cache-Control": [ "max-age=0" ], "Sec-Ch-Ua-Mobile": [ "?0" ], "Sec-Ch-Ua-Platform": [ ""Windows"" ], "Sec-Fetch-Site": [ "none" ], "Sec-Fetch-User": [ "?1" ], "Sec-Ch-Ua": [ ""Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"" ], "Accept-Encoding": [ "gzip, deflate, br" ], "Cookie": [], "Upgrade-Insecure-Requests": [ "1" ] }, "tls": { "resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "localhost" } }, "duration": 0.0081262, "status": 502, "err_id": "4f28xp1va", "err_trace": "reverseproxy.statusError (reverseproxy.go:1184)" }

CorneanuC avatar Sep 20 '22 07:09 CorneanuC

I can't close this item since it is not resolved.

Because I see on your reproducer that you have only do the step one.

maxhelias avatar Nov 25 '22 14:11 maxhelias

I had the same problem then i put the ports in my docker-compose file like this:

###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-14}-alpine
    ports:
      - "5433:5432"
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    volumes:
      - db-data:/var/lib/postgresql/data:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###

And I solved the problem

salletti avatar Dec 07 '22 12:12 salletti