Created
June 23, 2010 17:06
-
-
Save smathy/450209 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Doesn't work | |
<?php | |
declare(ticks = 1); | |
function sig_handler($s) { | |
die("Caught ALARM\n"); | |
} | |
pcntl_signal(SIGALRM, "sig_handler", true); | |
pcntl_alarm(2); | |
mysql_connect('localhostxx'); | |
die("Connected fine."); | |
?> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Works | |
<?php | |
declare(ticks = 1); | |
function sig_handler($s) { | |
die("Caught ALARM\n"); | |
} | |
pcntl_signal(SIGALRM, "sig_handler", true); | |
pcntl_alarm(2); | |
for(;;) {} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This one works (ie. gets to the connection) | |
<?php | |
declare(ticks = 1); | |
function sig_handler($s) { | |
die("Caught ALARM\n"); | |
} | |
pcntl_signal(SIGALRM, "sig_handler", true); | |
pcntl_alarm(2); | |
mysql_connect('localhost'); | |
die("Connected fine."); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment