iriscouch / fastcgi

Simple, robust node.js web server that runs FastCGI applications
Apache License 2.0
39 stars 13 forks source link

Unable to run nodejs fastcgi #2

Open treker opened 11 years ago

treker commented 11 years ago

Hi,

I tried to use nodejs with fastcgi but failed to execute it. Any comments? Thanks

root@ubuntu12:/tmp# ./node_modules/fastcgi/cli.js --port=1234 --socket=/tmp/php-fpm.socket Sending http requests to /tmp/php-fpm.socket Get FastCGI values Listening for FastCGI values

events.js:68 throw arguments[1]; // Unhandled 'error' event ^ Error: write EPIPE at errnoException (net.js:769:11) at Object.afterWrite (net.js:593:19)

root@ubuntu12:/tmp# node -v v0.8.11

root@ubuntu12:/tmp# npm ls /tmp ├─┬ fastcgi@0.1.1 │ ├── defaultable@0.7.2 │ ├── fastcgi-parser@0.1.5 │ └─┬ optimist@0.3.4 │ └── wordwrap@0.0.2 └─┬ request@2.11.4 ├─┬ form-data@0.0.3 │ ├── async@0.1.9 │ └─┬ combined-stream@0.0.3 │ └── delayed-stream@0.0.5 └── mime@1.2.7

jhs commented 11 years ago

Hi! Thanks for this bug report.

It looks like you are running PHP with that socket. That might be a clue (I have only tested with Python apps).

Would you please completely shut down your PHP stuff? Kill all php processes, and do not start them. Now run this fastcgi wrapper. Do you get the same error as before, or a different error? Does the error happen immediately, or only when you connect with a web browser/client?

Thanks!

treker commented 11 years ago

It's a little bit different when I stop the php/fastcgi process

root@ubuntu12:/tmp/node_modules/fastcgi# ./cli.js --port=1234 --socket=/tmp/php-fpm.socket Sending http requests to /tmp/php-fpm.socket Error: No such socket: /tmp/php-fpm.socket

/tmp/node_modules/fastcgi/cli.js:103 throw er ^ Error: connect ENOENT at errnoException (net.js:769:11) at Object.afterConnect as oncomplete

When I configure this php-fpm with nginx, it works correctly.

samitny commented 11 years ago

I'm having a similar issue using spawn-fcgi:

spawn-fcgi -s /tmp/php-cgi.sock -n -u lighttpd -g lighttpd -- /usr/bin/php-cgi

I managed to connect to the socket successfully when using fcgiwrap (along with the perl script).

I should note that there are other issues when using this project with php but those are outside of this issue's scope.

jhs commented 11 years ago

@samitny In your command-line example, I do not see where it runs this Node.js package. Am I missing something?

Also, please feel free to open new issues with your other problems. Like I said, I am mostly using this for Django so I would love to get it working better with PHP.

iamfat commented 10 years ago

I'm having same issue here

before php5-fpm started

jia.huang@gordon:~$ fastcgi --port=9628 --socket=/var/run/php5-fpm.sock
Sending http requests to /var/run/php5-fpm.sock
Error: No such socket: /var/run/php5-fpm.sock

/usr/lib/node_modules/fastcgi/cli.js:101
        throw er
              ^
Error: connect ENOENT
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

and after php5-fpm started

jia.huang@gordon:~$ sudo service php5-fpm start
php5-fpm start/running, process 9085
jia.huang@gordon:~$ fastcgi --port=9628 --socket=/var/run/php5-fpm.sock
Sending http requests to /var/run/php5-fpm.sock
Get FastCGI values
Listening for FastCGI values

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: read ECONNRESET
    at errnoException (net.js:901:11)
    at Pipe.onread (net.js:556:19)

@jhs