phantomJs权限被拒绝

时间:2018-07-04 13:00:40

标签: php phantomjs

有一个问题,我觉得应该不难解决,但我对Phantom Js并不真正熟悉。

$this->phantomProcess($path)->setTimeout(10)->mustRun();

此行导致以下错误:

protected function captureImage($view)
{
    $path = $this->writeFile($view);

    $this->phantomProcess($path)->setTimeout(10)->mustRun();

    return $path;
}

protected function writeFile($view)
{
    file_put_contents($path = 'storage/' . md5(uniqid()) . '.pdf' , $view);

    return $path;
}

protected function phantomProcess($path)
{
    return new Process('bin/phantomjs capture.js ' . $path);
}

我正在运行以下行:

Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\ProcessFailedException' with message 'The command "bin/phantomjs capture.js storage/7c5b791a0c1f131aac5c5ca272a1c891.pdf" failed. Exit Code: 126(Invoked command cannot execute) Working directory: /Applications/XAMPP/xamppfiles/htdocs/pdf Output: ================ Error Output: ================ sh: bin/phantomjs: cannot execute binary file ' in /Applications/XAMPP/xamppfiles/htdocs/pdf/vendor/symfony/process/Process.php:239 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/pdf/app/Codecourse/Capture/Capture.php(45): Symfony\Component\Process\Process->mustRun() #1 /Applications/XAMPP/xamppfiles/htdocs/pdf/app/Codecourse/Capture/Capture.php(24): Codecourse\Capture\Capture->captureImage('<!DOCTYPE html>...') #2 /Applications/XAMPP/xamppfiles/htdocs/pdf/index.php(17): Codecourse\Capture\Capture->load('invoice.php', Array) #3 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/pdf/vendor/symfony/process/Process.php on line 239

有人可以帮助我吗? 非常感谢,

0 个答案:

没有答案