问题:使用Warning: exec(): Unable to fork
hello.js
问题:我该如何使其发挥作用?
说明
我正在尝试让phantomJs在Windows服务器上运行。我在public_html
文件夹中有以下文件:
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。
问题:我该如何使其发挥作用?
答案 0 :(得分:1)
可能是phantomjs.exe的权限,您是否尝试过更改它们? http://php.net/manual/en/ref.exec.php#32601可以提供帮助
另外,您是否尝试使用完整路径?
但是必须说,public_html中的exe对我来说听起来有风险..我认为(使用错误的权限配置)任何人都可以远程执行,并且可能会将路径传递给您的任何文件服务器,包括非公共文件。
无法想到它需要专门去那里而不是更安全的非网络访问位置。
答案 1 :(得分:0)
实际上这可能与内存有关,而与权限无关。 Here关于同一问题的问题。
它可能是代码中其他地方的泄漏,但是phantomjs itself has some issues with memory consuming。