Skip to content

Instantly share code, notes, and snippets.

@DHager
Created December 3, 2015 20:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DHager/a63d36dade21150dd86d to your computer and use it in GitHub Desktop.
Save DHager/a63d36dade21150dd86d to your computer and use it in GitHub Desktop.
Tries to cause a core-dump so that you can test your PHP/Apache/OS configuration to make sure they are being saved
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
ob_end_flush();
$pid = getmypid();
$secs = 10;
$cmd = "kill -3 $pid";
echo("Pid is $pid<br/>\n");
echo("Sleeping for $secs<br/>\n"); // In case you want to kill it manually
flush();
sleep($secs);
echo("Attempting self-kill with $cmd<br/>\n");
flush();
// SIGQUIT is number 3, for some reason -SIGQUIT is not accepted
system($cmd);
sleep(1);
echo("Couldn't self-terminate<br/>\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment