Communication with php fastcgi socket from ruby -
i wish check correct php fastcgi operation ruby script. do that, wanted send simple php script socket , check correct return value.
now, new both ruby , sockets, tried
require 'socket' s = unixsocket.new("/var/run/php/php.socket") s.send('<?php print "hello world"; ?>', 0) puts s.recv(11)
but
test.rb:5:in `recv': connection reset peer - recvfrom(2) (errno::econnreset) test.rb:5:in `<main>'
google less helpful, because 'php' triggers many tutorials on how use sockets php.
i know php socket works correctly (since powers website). how script correctly receive "hello world"?
fastcgi has binary protocol need implement. in end you'd better use library has implemented you.
after might better off using bash script , program installed libfcgi library (apt-get install libfcgi-dev
on debian), example
script_filename=/path/test.php cgi-fcgi -bind -connect /var/run/php/php.socket
(jens corrected original example environment in comment, thanks)
Comments
Post a Comment