Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Error: spawn php-cgi ENOENT #17

Open
heimdallrj opened this issue Dec 17, 2016 · 8 comments
Open

Error: spawn php-cgi ENOENT #17

heimdallrj opened this issue Dec 17, 2016 · 8 comments

Comments

@heimdallrj
Copy link

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. :)

@mkschreder
Copy link
Owner

mkschreder commented Dec 17, 2016 via email

@AlexBezuska
Copy link

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

@FrenchMajesty
Copy link

Yea same here, I have PHP installed via homebrew on Mac but still get the same error.

@Ludovic42
Copy link

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
`

@kidBrazil
Copy link

For what its worth, I was able to get the error to go away by doing

  • sudo apt-get install php-cgi

@SamukaDEV
Copy link

SamukaDEV commented Jul 11, 2018

Ive solved this error on my MacOS High Sierra, simply appending a full-path to php-cgi:

image

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

@ganeshkbhat
Copy link

Cool this worked.

sudo apt-get install php-cgi

@ganeshkbhat
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants