服务器上的PhantomJS-PHP执行程序无法分叉


PhantomJS on server - PHP exec unable to fork

问题:使用hello.js 获取Warning: exec(): Unable to fork

问题:如何使其工作?

描述:我正试图让phantomJ在Windows服务器上运行。我在public_html文件夹上有以下文件:

  1. phantomjs.exe
  2. index.php
  3. 你好.js

其中index.php简单地为:

<?php $response = exec('phantomjs.exe hello.js');

hello.js为:

console.log("Hello world!");
phantom.exit();

当我运行index.php时,我得到以下错误:

Warning: exec(): Unable to fork [phantomjs.exe hello.js] in D:'sites'creditflow.com'public_html'index.php on line 1 

上面的代码目前托管在这里。

问题:如何使其工作?

可能是phantomjs.exe上的权限,您尝试过更改它们吗?http://php.net/manual/en/ref.exec.php#32601可能对有帮助

此外,您是否尝试过使用完整路径?

然而,必须说的是,public_html中的exe对我来说听起来有风险。我认为(使用错误的权限配置)任何人都可以远程执行,并可能传递到服务器上任何文件的路径,包括非公共文件。

想不出有什么理由需要专门去那里,而不是去一个更安全、不可上网的地方。

事实上,这可能与内存有关,而不是权限。这里有一个关于同一问题的问题。

它可能是代码中其他地方的泄漏,但是phantomjs本身存在一些内存消耗问题。