On A, I have scripted my server installation to install PHP (8.4.21), MySQL and Apache
On B, I have scripted my server installation to install PHP (8.4.21), MySQL and Nginx
For B, when re-running the script on a fresh machine recently, /var/run/php-fpm.sock is now missing and causing the Laravel site not to load in the browser
The script of A remains problem free
Has anyone faced the same issue and found a solution? I suspect it is in Nginx
Then enable it so it starts automatically on boot:
sudo systemctl enable php-fpm
This is assuming the service is named php-fpm in your system, which it probably is if the socket file was named php-fpm.sock before you rebooted. Often the service is versioned instead, e.g. php8.4-fpm.
You need php-fpm to run a Laravel app – or any PHP app for that matter – through Nginx. There are alternatives, but php-fpm is by far the most popular choice.
As I mentioned, the service may have a different name, such as php8.4-fpm. You can look for it:
systemctl list-unit-files | grep php
If you updated PHP and accidentally uninstalled php-fpm, you need to reinstall it.
You keep telling me how things should be, sure, but I already know that
There's no need to get snappy. I'm explaining what you need since you clearly don't know it.
I'm telling you how things are right now, so the big question is have you actually tried to install Nginx vs Apache on 22.04 after my OP?
I've installed both countless times on Ubuntu and other distros. But this has nothing to do with the installation of either. It has to do with php-fpm, or how it's used.
Here's what you need to do:
If php-fpm (or php8.4-fpm) isn't installed, you need to install it.
If it is installed, you need to start it.
If the service is running but the socket file is in another location, e.g. /var/run/php/php8.4-fpm.sock, you need to fix the path in your Nginx config.
The only useful pieces of information you've given so far are:
/var/run/php-fpm.sock no longer exists and your app doesn't work because of that.
There's no php-fpm service.
I can't tell you exactly what is wrong just based on that.