summaryrefslogtreecommitdiff
path: root/sapi/cgi/cgi_main.c
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>2000-04-19 15:37:43 +0000
committerThies C. Arntzen <thies@php.net>2000-04-19 15:37:43 +0000
commit19a957790111514f35c2b47cad34a26819d39aa0 (patch)
treebd9c10ff6de4031d16b6c9902b97817a4d0f9862 /sapi/cgi/cgi_main.c
parenta81e6bc04e98f93d82a4364ac78709fe28a24138 (diff)
downloadphp-git-19a957790111514f35c2b47cad34a26819d39aa0.tar.gz
ignore SIGPIPE in standalone-mode so that one can actually use fsockopen() *and* have the remote side close the socket whithout PHP dying!
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r--sapi/cgi/cgi_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 09379d12ba..bf8ba280b3 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -61,6 +61,10 @@
#include <syslog.h>
#endif
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
#include "zend_compile.h"
#include "zend_execute.h"
#include "zend_highlight.h"
@@ -334,6 +338,13 @@ int main(int argc, char *argv[])
#endif
+#if HAVE_SIGNAL_H
+ signal(SIGPIPE,SIG_IGN); /* ignore SIGPIPE in standalone mode so that sockets created via
+ fsockopen() don't kill PHP if the remote site closes it.
+ in apache|apxs mode apache does that for us!
+ thies@digicol.de 20000419 */
+#endif
+
#ifndef ZTS
if (setjmp(EG(bailout))!=0) {
return -1;