Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Always crashes from PHP, Perl, etc. #11999

dmyshkin opened this Issue · 3 comments

2 participants


On our CentOS 6.5 system, PhantomJS always crashes when executed with a simple 'hello world' script when executed via PHP or Perl triggered from Apache. If the php or perl script is run from the command line, it works. Note that this problem does NOT happen on our Ubuntu 8.04 machine. We have tried both building from source and the binaries. We are using the 64 bit version. The 32 bit version does not run at all, gives ELF error.

Crash message:
PhantomJS has crashed. Please read the crash reporting guide at and file a bug report at with the crash dump file attached: /tmp/7be7b6c1-232b-ad26-0bdc14c8-692edb4b.dmp

Perl script:
print "Content-type:text/html\r\n\r\n";
my $phantomjs = "/var/www/phantomjs /var/www/perl/testphantom.js";
$output = $phantomjs;

PHP script:
$result = system("/var/www/phantomjs testphantom.js");
echo $result;

console.log("hello world");

After trying to dump the symbols, this happens:
[root@prsgce-1 phantomjs-1.9.7-linux-x86_64-symbols]# ./minidump_stackwalk /tmp/7be7b6c1-232b-ad26-0bdc14c8-692edb4b.dmp .
2014-02-21 00:37:35: INFO: Processing minidump in file /tmp/7be7b6c1-232b-ad26-0bdc14c8-692edb4b.dmp
2014-02-21 00:37:35: INFO: Minidump opened minidump /tmp/7be7b6c1-232b-ad26-0bdc14c8-692edb4b.dmp
2014-02-21 00:37:35: ERROR: ReadBytes: read 0/32
2014-02-21 00:37:35: ERROR: Minidump cannot read header
2014-02-21 00:37:35: ERROR: Minidump /tmp/7be7b6c1-232b-ad26-0bdc14c8-692edb4b.dmp could not be read
2014-02-21 00:37:35: INFO: Minidump closing minidump


I'm not overly familiar but I have a leading question: if you exec an external executable from within PHP/Perl/etc., is that child process confined to the memory allocated for the parent script process? If so, I would check to ensure that your Apache config isn't limiting the process (or child processes) to a small chunk of memory. 64-bit Phantom (WebKit) on Linux will attempt to reserve 1 GB of memory right when it starts, IIRC.


So, I have some more information:
1) I was able to get the 'instant crash' to stop happening from PHP, by setting the httpd_execmem se bool to true.
2) While the "hello world" script runs fine now, the actual script i'm trying to run (which waits for the page it loads to fire a callback, and then outputs the results), does something even stranger - when you run the script from the command line (not via PHP), it first outputs the "PhantomJS has crashed" message, then immediately outputs the results of the callback (the data), as if it had not crashed.
3) the actual script (callback watcher) simply hangs when run through PHP, it does not generate any output nor terminates.
4) all of this works fine on my Ubuntu system, both command line and through PHP, so to answer your question about the memory boxing - if that was the case it wouldn't work on Ubuntu either. Both have a similar Apache configuration.


Here is the actual script i am trying to run (the one that crashes right away from command line then spits out the output)

var page = require('webpage').create();
var system = require('system');
var address = system.args[1];;
page.onCallback = function(data) {

and the page it's trying to render:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.