Closed steffanhalv closed 7 years ago
hmm - never seen that one. I see that you are using an older version of node (v4.7.2) What is your setup? express version? ws version? php-cgi version?
Looks similar to https://github.com/angular/angular-phonecat/issues/303 I now updated everything to latest but receiving same error
"dependencies": {
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~3.0.0",
"express": "^4.15.4",
"morgan": "~1.8.1",
"pug": "~2.0.0-beta11",
"serve-favicon": "~2.4.2",
"sphp": "^0.4.3",
"ws": "^3.1.0"
}
PHP 7.0.22-0ubuntu0.17.04.1 (cgi-fcgi) (built: Aug 8 2017 22:03:30)
I did also lookup what was sent to callback('header','Location',line[i].substr(div+2));
(Line 578 in sphp.js)
And it looked quiet normal: callback('header','Location','http://35.193.157.4/haagen/index.php');
_http_outgoing.js:507
throw new TypeError('The header content contains invalid characters');
^
TypeError: The header content contains invalid characters
at validateHeader (_http_outgoing.js:507:11)
at ServerResponse.setHeader (_http_outgoing.js:511:3)
at /home/steffanhalv/cloud-npm-php/node_modules/sphp/sphp.js:108:18
at Socket.<anonymous> (/home/steffanhalv/cloud-npm-php/node_modules/sphp/sphp.js:578:15)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:235:13)
at Socket.Readable.push (_stream_readable.js:197:10)
at Pipe.onread (net.js:589:20)
response.setHeader(data,param);
at line 110 in sphp.js refer to?The variables becomes
var data = 'Location';
var data param = 'http://35.193.157.4/haagen/wp-admin/install.php';
And I tried this test nodejs server on same linux server:
var http = require('http');
http.createServer((req, res) => {
res.setHeader('Location', 'http://35.193.157.4/haagen/wp-admin/install.php');
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hi!');
res.end();
}).listen(80);
Which works just fine and outputs this headers from chrome:
HTTP/1.1 200 OK
Location: http://35.193.157.4/haagen/wp-admin/install.php
Content-Type: text/plain
Date: Fri, 11 Aug 2017 07:34:54 GMT
Connection: keep-alive
Transfer-Encoding: chunked
@paragi
The error did come from /r character.
Fixed by 015b41574531ed8210159fa92afeddf18d3c5795 #6
Thank you for fixing it!
I haver never tried it with PHP 7 or wordpress. (It was intended for embedded systems) How did that go?
The response.setHeader(data,param) in line 108 is buffering and eventually sending http headers to the client. The line you describe is a page redirecting to another page. I'm not familiar with the inner workings of wordpress, but it's not an uncommon thing to do.
At a quick glance i suspect the issue arise from line 568. But I will accept you changes for now, and look deeper into it, at a later time.
Thank you for your effort.
Thank you. I did come to installation page 2 in wp, but then it didnt work to catch $_POST. But $_GET did work ..
I didnt manage to install it because of this and using nginx for now. But I would like to use npm later for development if its possible without big configs etc.
Hi Steffan As mentioned, I didn't expect this package to be used in the manner you described. But I found wordpress to be an interesting test case. I have rewriten the the superglobal part and header handling.
Would you be so kind as to test it against your application? There is a new version at NPM and gitHub.
Hi, I would be glad to :)
This could be useful in the future, I will do when I get free time
Regards Steffan
2017-11-06 0:26 GMT+01:00 Simon Rigét notifications@github.com:
Hi Steffan As mentioned, I didn't expect this package to be used in the manner you described. But I found wordpress to be an interesting test case. I have rewriten the the superglobal part and header handling.
Would you be so kind as to test it against your application? There is a new version at NPM and gitHub.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/paragi/sphp/issues/5#issuecomment-342014858, or mute the thread https://github.com/notifications/unsubscribe-auth/AEYWIJNkyfDf8hWI8RxupDMIGfsw1lB2ks5szkQvgaJpZM4OzpJe .
C:\Users\steff\Desktop\npm\php>npm run dev
php@1.0.0 dev C:\Users\steff\Desktop\npm\php node index.js
C:\Users\steff\Desktop\npm\php\node_modules\sphp\sphp.js:459 throw new Error(str); ^
Error: PHP worker script ended with error.
PHP engine: C:\Users\steff\AppData\Local\scoop\apps\php\7.0.12\php-cgi.exe
Preburner script: /php_worker.php
Error code: 4294967295
at FormDebugMessage (C:\Users\steff\Desktop\npm\php\node_modules\sphp\sphp.js:459:11)
at ChildProcess.node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the php@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\steff\AppData\Roaming\npm-cache_logs\2017-12-14T03_21_39_381Z-debug.log
C:\Users\steff\Desktop\npm\php>
Still not working for wordpress!
When I try to log in, I get sendt arround there pages: Serving PHP page: /wp-login.php Serving PHP page: /wp-admin//index.php Serving PHP page: /wp-login.php
Last time, the UTL is: http://localhost:8080/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A8080%2Fwp-admin%2F&reauth=1
Do you know whats going on with wordpress? Could it be a cookie issue?