douyan2002 2016-05-11 22:34
浏览 89

PhantomJS脚本的shell_exec杀死了PHP-FPM和Apache

I am having a very strange issue with a shell_exec. What I am trying to do is to call a PhantomJS and pass 4 arguments to it (user Session ID, URL, file save name and element that I need to take) using shell_exec in order to make a screenshot of a certain element on a page.

So, my command looks like this:

/usr/local/bin/phantomjs  --ignore-ssl-errors=true  /Users/Igor/Sites/something/public_html/lib/phantomjs/script.js https://testsite.com/dashboard/\?dashboard_view=somedash /Users/Igor/Sites/something/uploads/screenshots/j78O3LstYumBnUi fef81e774e845d44044c167c6847f4d1 chart1 2>&1

This is what I execute using shell_exec:

$command = ' --ignore-ssl-errors=true ' . $this->script . ' ' . escapeshellarg($this->uri) . ' ' . escapeshellarg($path) . ' ' . $this->session . ' ' . $this->element;
$output = shell_exec("$this->phantomjs $command 2>&1 1> /dev/null");

After I call shell_exec I clearly see that command has been executed using "ps uax | grep phantom" but it stays there forever, causing a instant death of PHP-FPM (v5.4.45) and Apache2 on a server. I need to add that I am executing this command asynchronously via AJAX call.

I've tried different approaches - using something else instead of shell_exec, making a Bash script that will accept arguments, PhantomJS Runner.... nothing works.

If I execute this command in a console - it works without issues.

I am out of ideas really - not sure how to proceed any further so any help would be appreciated.

  • 写回答

3条回答 默认 最新

  • duandang2123 2016-05-12 01:29
    关注

    Maybe it's a file permissions issue? What are the permissions of /Users/Igor/Sites/something/public_html/lib/phantomjs/script.js?

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用