Closed thany closed 5 years ago
Apollon77 do you have any comments to that?
I lack the experience with windows to answer this. Except for the error in the error message, the issue seems to be that it can't find the executable file or don't have the permissions to run it.
No idea beside enhancing L320 and also output the error variable ... maybe this helps seeing the real problem ?!
@thany: try adding " + error" to L320 output and say what it is
It seems that php-cgi doesn't return version.
what is the first line returned, with this in the command line interface?: D:\Projects\php\php-cgi.exe -v
What is the return code of the command? (I don't know how to test in windows)
It seem that a very common problem is that PHP is difficult to install as a stand alone CLI tool, on windows. If there is a problem with PHP, starting from the command line, it will show in a popup window. (For instance if the VC rumtime dll is not installed) The result will look excatly like the above issue.
PLEASE check that php-cgi is running correctly on your system: in CLI php-cgi -v
@paragi But I still would prefer output of the real error in "catch" situations because normally this helps a lot to see the real reason. Also could be that the path is wrong and binary not found at all :-)
I agreed. Lets have a look at the error handling in general. How could we handle fatal errors in an event, if not with a throw?
The path is shown further down, The throw statement you see is just the stack trace. I was puzzled by that too :)
I've copied your example script into a file
test.js
and adapted it slightly:That path is absolutely correct. I also tried with slashes instead of backslashes with no differece. Just to be sure.
This is the exact error I'm getting:
I can copypaste that path, and sure enough, it's correct. PHP starts just fine. Well, it doesn't error immediately, and PHP directly from the CLI is rather useless, but still, it does actually work for what little it does. So why does it not work from sphp? What am I missing?
Software I'm using: Node 8.11.3 LTS PHP 7.2.11 x64 thread safe Windows 10