服务器上的 PhantomJS - PHP exec 无法分叉

PhantomJS on server - PHP exec unable to fork

问题: 使用 hello.js

获取 Warning: exec(): Unable to fork

问题:我怎样才能让它工作?

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

  1. phantomjs.exe
  2. index.php
  3. hello.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 

以上代码当前托管在 here

问题:我怎样才能让它工作?

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

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

但是必须说,public_html 中的 exe 对我来说听起来很冒险.. 我 认为 (使用错误的权限配置)任何人都可以远程执行它,并且可能将路径传递到您服务器上的任何文件,包括非 public 文件。

想不出有什么理由需要专门去那里而不是在一个更安全的非网络访问位置。

其实这很可能是内存的问题,与权限无关。 Here 关于同一问题的问题。

这可能是您代码中其他地方的泄漏,但是 phantomjs itself has some issues with memory consuming