node-php
node-php copied to clipboard
Error: spawn php-cgi ENOENT
I am getting this error message when I tried run a php script with this;
{ Error: spawn php-cgi ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn php-cgi',
path: 'php-cgi',
spawnargs: [] }
Appreciate if one has an idea what cause this error. :)
Install php-cgi (usually part of php package)
On 17 Dec 2016 12:20, "Ind" [email protected] wrote:
I am getting this error message when I tried run a php script with this;
{ Error: spawn php-cgi ENOENT at exports._errnoException (util.js:1026:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32) at onErrorNT (internal/child_process.js:348:16) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn php-cgi', path: 'php-cgi', spawnargs: [] }
Appreciate if one has an idea what cause this error. :)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mkschreder/node-php/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AERqiYHEnb0VHQ3THDfKMNo2PgKO8MOOks5rI8V4gaJpZM4LP3QO .
I am getting this same error, I am trying to use this module to serve a wordpress site locally on mac osx. I have php-cgi installed via homebrew on mac,
PHP 5.4.45 (cgi-fcgi) (built: Jan 18 2017 11:32:40)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
$ which php-cgi
/usr/local/bin/php-cgi
Yea same here, I have PHP installed via homebrew on Mac but still get the same error.
I've got the same error while running the example.js on linux, and php-cgi is installed (npm install --save php-cgi)
`/node_modules/sphp$ node example.js events.js:160 throw er; // Unhandled 'error' event ^
Error: spawn php-cgi ENOENT at exports._errnoException (util.js:1020:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:367:16) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) at Module.runMain (module.js:606:11) at run (bootstrap_node.js:389:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:504:3 `
For what its worth, I was able to get the error to go away by doing
- sudo apt-get install php-cgi
Ive solved this error on my MacOS High Sierra, simply appending a full-path to php-cgi:
I think this error is cause the node-php\main.js[child.spawn] isnt finding the php-cgi by $PATH
Note: i have tried all kind of installations of php and different versions, but the error has persist, then i solved with the full-path(solution of image) in node-php version 0.0.1
Cool this worked.
sudo apt-get install php-cgi
On a second thought it will be nice to get the paths for php/cgi dynamic from a config file with a default for system, if not specified.