简体   繁体   中英

Problem with Symfony 5 in prod but not dev

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:)

Do you use Webpack? Have you tried deleting the prod folder in var/cache? Otherwise I had made a short video showing how to deploy symfony, you can try to follow the procedure (video in French)

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM