Connect() to unix:/run/php/php-fpm.sock failed (2: No such file or directory) while connecting to upstream ninja invoice

Hi ninja community?

I have debian 10 OS and nginx as web server. I followed Install Invoice Ninja v5 on Ubuntu 20.04
to install ninja invoice. But I am getting following errors in my server error log.

connect() to unix:/run/php/php-fpm.sock failed (2: No such file or directory) while connecting to upstream ninja invoice
Please help me to fix it. Thanks & Regards!

Hello!

Can you check the statuses of php-fpm & nginx?

sudo service nginx status
sudo service php-fpm status

Yes, I have checked the status of both services i.e. nginx and php7.3-fpm but both are up and running.

One of two things, either that is not the path for php-fpm.sock, and you should edit the path in nginx config. Otherwise it is permissions. Verify that the file at that path exists (only exist while service running). Then check permission. Php config can help set default permissions of a sock file, since it respawns with default every time you reboot or restart the service.

The Ubuntu instructions are highly streamlined because of effective default configs that I assume don’t exist in Debian or are just different.

Systemctl status php-fpm will tell you the path of current php .sock file and its name (sometimes www.sock). Verify that path, and configure nginx accordingly and verify nginx has permission to the sock file.

See my CentOS guide which already has examples of these steps, you will have to adapt them to your environment.

Hi dear?
I have checked your suggested solutions but now start getting following error.
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 182.187.109.183, server: ninja.liveinc.ca, request: "GET /favicon.ico HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "ninja.liveinc.ca", referrer: "https://ninja.liveinc.ca/"

Can you please share you email address so that I can share ssh creds of my server with you??

Hey @hafiznaseraslam,

Looks like something’s wrong with Nginx. Can you try this solution? https://serverfault.com/a/517327