-
Notifications
You must be signed in to change notification settings - Fork 5.7k
2.1.1 crashes when being invoked from webserver using php 1.9.7 does not #14008
Comments
if you look at the proc_open example on http://php.net/manual/en/function.proc-open.php it is suggested to close the pipes before proc_close, to prevent a deadlock. What happens if you run the first command manually from the command line? |
@orthosie Thank you for your bug report. Unfortunately, we cannot do anything about it without a reduced, self-contained test case. Please read our draft bug reporting guidelines and follow the instructions. If they are unclear, please let us know in the discussion thread on that document. In this case, it is clear that the problem is related to running PhantomJS under PHP instead of in a terminal, but we also need a minimized version of |
@GDmac closing the pipes didn't solve the problem. @zackw attaching pageprint.js and also made a special page (which won't change) to reproduce the problem (using the short url for convenience here, but the problem happens regardless whether I use the short url or not). <?php
error_reporting(E_ALL);
$cmd = "/home/me/toolkits/phantomjs/2.1.1/x86_64/bin/phantomjs --ignore-ssl-errors=yes --ssl-protocol=any /home/me/lib/pageprint.js https://goo.gl/MDrfz9 /home/me/YhXV6EStHS_hCmZH061iuQeF.png";
$dp = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "phantomjs-error-output.txt", "a") // stderr is a file to write to
);
$fd = proc_open ("$cmd", $dp, $foo);
fclose($foo[0]);
fclose($foo[1]);
proc_close ($fd);
?> |
That page contains some huge assets (5mb image ???). Anyway, as asked, have you tried running the command at the commandline? (your example works ok on phantomjs-2.1.1-macosx) ps. you can mark php code blocks, makes them easier to read (code) |
@GDmac & @zackw thanks for looking into this. @GDmac as mentioned in the initial post this works when invoked from command line (php and just plain shell both works fine). The problem exhibits itself only when called in the webserver context i.e. via url in the browser. Also I have tried with very small image size (200kb) as well and it has the same problem. Made some progress. Figured out exactly what portion of the page is causing the crash. If the SVG CSS filters in the header is removed this works. I guess 1.9.7 never paid attention to the filters but 2.1.1 does and that is the reason 1.9.7 works here. But what I don't understand is why 2.1.1 should fail only in the webserver context and not in command line shell or command line php context? |
i had no problem to run the example on my local apache. |
I'll be watching this thread, as I am experiencing the exact same problems. |
I'll second adamdyson as I am experiencing the exact same problem. Works perfectly fine with 1.9.7, but I have rendering issues with that version. Crashes with 2.1.1 through php exec calls from server context, but doesn't from command line shell. |
Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution! |
Ubuntu Linux 3.2.61-grsec-modsign #1 SMP x86_64 GNU/Linux , Apache
I have been using phantomjs 1.9.7 to take screen shots through php. I am trying to upgrade to 2.1.1 and the same command using 2.1.1 is not working. The error output says phantomjs crashed. This is what is being printed to the error log.
PhantomJS has crashed. Please read the bug reporting guide at
http://phantomjs.org/bug-reporting.html and file a bug report.
The following is the php. Both 1.9.7 and 2.1.1 works fine from command line without php or when the following php is being invoked from the command line. But 2.1.1 crashes when invoked from a webserver while accessing via url.
array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "phantomjs-error-output.txt", "a") // stderr is a file to write to ); proc_close (proc_open ("$cmd19", $dp, $foo)); ?>The text was updated successfully, but these errors were encountered: