Last active
June 20, 2018 16:10
-
-
Save solepixel/20cb1bc5041541f3bcff2a775b350a40 to your computer and use it in GitHub Desktop.
When load balancers have set timeouts at 30 seconds, this script will process requests that may take longer than 30 seconds (up to 15 minutes) without causing a timeout.
This file contains 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
<?php | |
/** | |
* Source: | |
* @link https://web.archive.org/web/20160403212324/http://cloudsitesrock.com/?ac=list&cat=6&m=0&y=0 | |
*/ | |
$cmd = "zip -9prv content_backup.zip ."; | |
$pipe = popen($cmd, 'r'); | |
if (empty($pipe)) { | |
throw new Exception("Unable to open pipe for command '$cmd'"); | |
} | |
stream_set_blocking($pipe, false); | |
echo "\n"; | |
while (!feof($pipe)) { | |
fread($pipe, 1024); | |
sleep(1); | |
echo "."; | |
flush(); | |
} | |
echo "\n"; | |
echo "Complete"; | |
pclose($pipe); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment