| | 398 | |
|---|
| | 399 | // fix php behavior if using cgi php |
|---|
| | 400 | // from http://www.sitepoint.com/article/php-command-line-1/3 |
|---|
| | 401 | if (false !== strpos(php_sapi_name(), 'cgi')) |
|---|
| | 402 | { |
|---|
| | 403 | // handle output buffering |
|---|
| | 404 | @ob_end_flush(); |
|---|
| | 405 | ob_implicit_flush(true); |
|---|
| | 406 | |
|---|
| | 407 | // PHP ini settings |
|---|
| | 408 | set_time_limit(0); |
|---|
| | 409 | ini_set('track_errors', true); |
|---|
| | 410 | ini_set('html_errors', false); |
|---|
| | 411 | ini_set('magic_quotes_runtime', false); |
|---|
| | 412 | |
|---|
| | 413 | // define stream constants |
|---|
| | 414 | define('STDIN', fopen('php://stdin', 'r')); |
|---|
| | 415 | define('STDOUT', fopen('php://stdout', 'w')); |
|---|
| | 416 | define('STDERR', fopen('php://stderr', 'w')); |
|---|
| | 417 | |
|---|
| | 418 | // close the streams on script termination |
|---|
| | 419 | register_shutdown_function(create_function('', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;')); |
|---|
| | 420 | } |
|---|