1

I have a problem with my project in symfony 5.4 (recently update from 4.4) I deploy my project on the prod server (on a subdomain) and he don't work in prod environnement, but work in dev. I already :
_ fix permissions for /var folder
_ set up vhosts (i'm on plesk so i put directives in vhost.conf, in my subdomain)
_ install and update composer

The problem is that there is a lot of missing image (it's ok they are on prod), when i run the project in dev, missing image return a 404 error, but when i turn symfony on prod, missing image return a 500 error, and then the all site is on error 500 untill i clear symfony cache.

I have the previous verison (the 4.4 one), who run in the principal domain, and i dont have this problem. I deploy the exact same project (the new one in 5.4), in an others test server, and he works in dev and prod (no error 500 on image).

I think it's a server problem, but i passed 4 days on this, i tried a lot of thing, and i'm still stuck :)

Appheros
  • 29
  • 4
  • What does your Symfony and/or PLESK Log say about the 500 error? – user1915746 Sep 20 '22 at 08:46
  • Hi, sorry i forgot tu put error. This is the messages i got in prod log symfony : request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://subdomain.com/images/image.jpg" (from "https://subdomain.com/")" at subdomain/vendor/symfony/http-kernel/EventListener/RouterListener.php line 135 – Appheros Sep 20 '22 at 08:48
  • And : Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/images/image.jpg/\". at /subdomain/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:74) – Appheros Sep 20 '22 at 08:52
  • This is the erros on error_log, in plesk : [fcgid:warn] [pid 17262] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: https://subdomain.com/ [core:error] [pid 17262] End of script output before headers: index.php, referer: https://subdomain.com/ – Appheros Sep 20 '22 at 08:54
  • Could be a timeout issue. See https://stackoverflow.com/questions/62762559/end-of-script-output-before-headers-in-apache-php – user1915746 Sep 20 '22 at 09:19
  • Does `/public/images/image.jpg` actually exist on the production server? – Bossman Sep 20 '22 at 09:48
  • Hi, i will investigate for the timeout issue. THe image don't exist on the subdomain, where the project in 5.4 run. I tried to prefix the asset with the pord URL, and even with image, i got the same issue. Thanks for your replis btw! – Appheros Sep 20 '22 at 10:33
  • The thing i can't understand, is why i got error 500 on missing image on prod?? And 404 in dev?? It should be 404 no? – Appheros Sep 20 '22 at 10:35

1 Answers1

1

First, thank you for trying to help me, i appreciate that. So.

For removing the error with the image (error 500 instead 404), it appears that the problem was coming from my error templates 'bundles/TwigBundles/error.html.twig', i removed all the code and try just a simple tag, clear the cache and then the missing images trhow a 404 error.
I also reinstall composer require symfony/twig-pack
This helped me : https://stackoverflow.com/a/13741553/20040268
So the site was running fast this time, but as soon i changed page, error 500 again...at least it was fast ^^

So i keep digging, and like @user1915746 said, i started searching with php and the error code i send : mod_fcgid: error reading data from FastCGI server.

I tried a lot of thing for removing this error like : https://stackoverflow.com/a/12192622/20040268
But still not resolved my problem. Finally i decided to change the all php ^^ I was in 7.4.30, i pass in php 8.0.20 and...voila...no more error 500...

If you guys have the same thing, and tried all i tried, change php version or if you can't try to see if you don't have missing package (like php-cgi).

Thank you again for your time!

Appheros
  • 29
  • 4