How to pass data to php-fpm socket in go using sockets - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, September 25, 2022

How to pass data to php-fpm socket in go using sockets

I would like to ask you for help because I have a question about unix sockets in golang. I want to try to connect to the php-fpm service in golang (I'm on a Linux machine), and I think I can connect, but how can I interact with it? Let me explain what I mean, this is my code:

fcgi, err := net.Dial("unix", "/run/php-fpm/php-fpm.sock")

if err != nil {
    log.Fatal("Connection error: ", err)
}

And the code above works perfectly. But how can I start using it? I mean maybe execute php files from the socket, get their output or the headers that the program returns and stuff like that. I've been looking for ways to do it for days, but I can't find how, I've found libraries to do it but they haven't worked for me, like this library. Do you know any way to start using that socket and start working with php files from the same socket? Thanks in advance.



source https://stackoverflow.com/questions/73767235/how-to-pass-data-to-php-fpm-socket-in-go-using-sockets

No comments:

Post a Comment