Forum

FastCGI with UNIX file socket: Permission denied

Sam
12 December 2018, 04:53
Thanks so much for all your hard work, Hugo. This is an excellent piece of software.

I am using Hiawatha 10.3, and am attempting to set up FastCGI over a UNIX file socket. However, it doesn't work. (I was able to get CGI mode working.)

The interesting part of my hiawatha.conf is like this:
Hostname = 127.0.0.1
WebsiteRoot = /var/www/apm
StartFile = index.html
UseFastCGI = FCGI

FastCGIserver {
FastCGIid = FCGI
ConnectTo = /tmp/fcgi.sock
Extension = cgi
}

Am I correct in saying that the backend is the one that creates the socket file, and Hiawatha opens the existing socket file? It seems to function that way for me.

So my backend is running and has created the socket file /tmp/fcgi.sock.
When Hiawatha receives an FCGI request, it attempts to call connect_to_unix_socket() in libfs.c, it fails the connect() call (line 733), with errno 13 (Permission denied).
The socket file can be found in the list in /proc/net/unix.

Perhaps it is something just silly. I am using a simple embedded Linux that has only the root user and none other.
Has this socket error happened before with anyone?
Sam
12 December 2018, 04:57
I meant to say that the errors in the error log are the usual:
"can't connect to FastCGI server FCGI"
"FastCGI server FCGI is still (partially) unavailable"

I added my own debug trace prints to work out the Permission denied and errno.
Hugo Leisink
15 December 2018, 17:37
Do you start PHP via FPM? If so, check the PHP configuration where the socket file is created. Make sure that socket file is readable for Hiawatha.
This topic has been closed.