can't connect do database on phpfpm (fcgid works)

It’s already two times that I can’t use php execution FPM because I get a “unable to connect to the database”.
If I switch to FCGID the db connection works.