Skip to content

Instantly share code, notes, and snippets.

@carstingaxion
Created January 5, 2023 23:12
Show Gist options
  • Save carstingaxion/6a5c00427c2aaa9163c039dc3ea956b1 to your computer and use it in GitHub Desktop.
Save carstingaxion/6a5c00427c2aaa9163c039dc3ea956b1 to your computer and use it in GitHub Desktop.
Check for support of fastcgi_finish_request()
<?php
$file = __DIR__ . '/text.txt';
if (is_file($file) && is_writable($file)) {
@unlink($file);
echo '<small style="color: #ccc;">' . $file . ' was deleted.</small><br>' . PHP_EOL;
}
echo '<p>Calling to <code>fastcgi_finish_request()</code>.</p>' . PHP_EOL;
echo '<p>If success, the file ' . $file . ' will be created.</p>' . PHP_EOL;
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} else {
echo '<p style="color: red;">This server does not support <code>fastcgi_finish_request()</code> function.</p>' . PHP_EOL;
echo 'Exit now.<br>' . PHP_EOL;
exit();
}
echo 'This line will be not echo out.<br>' . PHP_EOL;
file_put_contents($file, date('Y-m-d H:i:s') . PHP_EOL, FILE_APPEND);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment