Getting ECONNRESET on child.stdin.write

Need some help getting CGI to work. I’m writing a small plugin for nodejs that allows running a wordpress site without apache.

I have done most of the groundwork so running a wordpress site works great now, but only needing to get files uploads to work properly. I managed to make simple file uploads work, but with larger files I get ECONNRESET when trying to write to stdin of the php-cgi process.

Read More

The code is here: git clone https://github.com/mkschreder/node-php.git

To test the code do this:

var express = require('express');
var php = require("./main"); 
var path = require("path"); 
var request = require("request"); 
var http = require("http"); 

var app = express();
var server = http.createServer(app);
app.use("/", php.cgi("/path/to/wordpress/install")); 

server.listen(9090);

console.log("Server listening on: "+server.address().port); 

Now if I run this with node and go to the admin panel of wordpress at localhost:9090 and then try to upload a theme or plugin, the server gets econnreset when calling php.stdin.write on the wordpress process during file upload. It works though if I call php.stdin.end() right afterwards, but the data is still only partially received in wordpress. With images it works fine though if the image is small enough.

Related posts

Leave a Reply