summaryrefslogtreecommitdiff
path: root/sapi/apache
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/apache')
-rw-r--r--sapi/apache/Makefile.am2
-rw-r--r--sapi/apache/Makefile.inc1
-rw-r--r--sapi/apache/apache.c99
-rw-r--r--sapi/apache/config.m417
-rw-r--r--sapi/apache/libphp4.module.in7
-rw-r--r--sapi/apache/mod_php4.c40
6 files changed, 115 insertions, 51 deletions
diff --git a/sapi/apache/Makefile.am b/sapi/apache/Makefile.am
index 8661c36f80..e5c8b14a99 100644
--- a/sapi/apache/Makefile.am
+++ b/sapi/apache/Makefile.am
@@ -3,4 +3,4 @@
APACHE_INCLUDE=@APACHE_INCLUDE@
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend $(APACHE_INCLUDE)
noinst_LIBRARIES=libphpsapi_apache.a
-libphpsapi_apache_a_SOURCES=mod_php4.c
+libphpsapi_apache_a_SOURCES=apache.c
diff --git a/sapi/apache/Makefile.inc b/sapi/apache/Makefile.inc
index 8b62c74c35..69dc6237f1 100644
--- a/sapi/apache/Makefile.inc
+++ b/sapi/apache/Makefile.inc
@@ -20,4 +20,5 @@ libmodphp4-so.a: all-recursive $(OBJS) sapi/libphpsapi.a $(REGEX_LIB)
# Apache 1.3 shared module
libphp4.so: libmodphp4-so.a $(REGEX_LIB)
+ (cd sapi/apache; $(MAKE) mod_php4.o)
$(APXS) $(INCLUDE) -c -o libphp4.so $(VERSION_SCRIPT) $(RPATHS) sapi/apache/mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
diff --git a/sapi/apache/apache.c b/sapi/apache/apache.c
new file mode 100644
index 0000000000..0e8b8029af
--- /dev/null
+++ b/sapi/apache/apache.c
@@ -0,0 +1,99 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP version 4.0 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997, 1998, 1999 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available at through the world-wide-web at |
+ | http://www.php.net/license/2_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Rasmus Lerdorf <rasmus@php.net> |
+ | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+ | PHP 4.0 patches by: |
+ | Zeev Suraski <zeev@zend.com> |
+ | Stig Bakken <ssb@fast.no> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "httpd.h"
+#include "http_config.h"
+#if MODULE_MAGIC_NUMBER > 19980712
+# include "ap_compat.h"
+#else
+# if MODULE_MAGIC_NUMBER > 19980324
+# include "compat.h"
+# endif
+#endif
+#include "http_core.h"
+#include "http_main.h"
+#include "http_protocol.h"
+#include "http_request.h"
+#include "http_log.h"
+
+#include "zend.h"
+#include "php.h"
+#include "php_ini.h"
+#include "php_globals.h"
+#include "SAPI.h"
+#include "main.h"
+#include "zend_compile.h"
+#include "zend_execute.h"
+#include "zend_highlight.h"
+#include "zend_indent.h"
+#include "ext/standard/php3_standard.h"
+#include "util_script.h"
+#include "php_version.h"
+/*#include "mod_php4.h"*/
+
+PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
+{
+ zend_file_handle file_handle;
+#ifdef ZTS
+ zend_compiler_globals cg;
+ zend_executor_globals eg;
+ php_core_globals pcg;
+ zend_compiler_globals *compiler_globals=&cg;
+ zend_executor_globals *executor_globals=&eg;
+ php_core_globals *core_globals=&pcg;
+#endif
+ SLS_FETCH();
+
+ if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+ file_handle.type = ZEND_HANDLE_FD;
+ file_handle.handle.fd = fd;
+ file_handle.filename = SG(request_info).path_translated;
+
+ if (display_source_mode) {
+ zend_syntax_highlighter_ini syntax_highlighter_ini;
+
+ if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
+ php_get_highlight_struct(&syntax_highlighter_ini);
+ zend_highlight(&syntax_highlighter_ini);
+ fclose(file_handle.handle.fp);
+ return OK;
+ } else {
+ return NOT_FOUND;
+ }
+ } else {
+ (void) php_execute_script(&file_handle CLS_CC ELS_CC);
+ }
+
+ php3_header(); /* Make sure headers have been sent */
+ php_end_ob_buffering(1);
+ return (OK);
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index b1bd590ed2..7489f25fd6 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -1,14 +1,5 @@
dnl ## -*- sh -*-
-divert(1)
-
-if test "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP="-bE:sapi/apache/mod_php4.exp"
-fi
-AC_SUBST(APXS_EXP)
-
-divert(2)
-
AC_MSG_CHECKING(for Apache module support via DSO through APXS)
AC_ARG_WITH(apxs,
[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
@@ -42,7 +33,8 @@ AC_ARG_WITH(apxs,
AC_MSG_RESULT(no)
])
-APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module"
+APACHE_INSTALL_FILES="sapi/apache/mod_php4.* sapi/apache/libphp4.module"
+PHP_OUTPUT(sapi/apache/libphp4.module)
if test "$SAPI_TARGET" != "libmodphp4-so.a"; then
if test "$SAPI_TARGET" != "libphp4.so"; then
@@ -168,6 +160,11 @@ dnl## AC_SUBST(APACHE_INCLUDE)
fi
fi
+if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
+ APXS_EXP="-bE:sapi/apache/mod_php4.exp"
+fi
+
+AC_SUBST(APXS_EXP)
AC_SUBST(APACHE_INCLUDE)
AC_SUBST(APACHE_TARGET)
AC_SUBST(APXS)
diff --git a/sapi/apache/libphp4.module.in b/sapi/apache/libphp4.module.in
new file mode 100644
index 0000000000..9b80f6c742
--- /dev/null
+++ b/sapi/apache/libphp4.module.in
@@ -0,0 +1,7 @@
+Name: php4_module
+ConfigStart
+ RULE_WANTHSREGEX=@HSREGEX@
+ LIBS="@RPATHS@ @PHP_LIBS@ @EXTRA_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS"
+ RULE_HIDE=yes
+ CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/libzend -I@abs_builddir@/libzend -I@abs_builddir@"
+ConfigEnd
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index 2f844738f6..bb67e4a9f5 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -93,46 +93,6 @@ php_apache_info_struct php_apache_info; /* active config */
/* some systems are missing these from their header files */
-PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
-{
- zend_file_handle file_handle;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- php_core_globals pcg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=&eg;
- php_core_globals *core_globals=&pcg;
-#endif
- SLS_FETCH();
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return FAILURE;
- }
- file_handle.type = ZEND_HANDLE_FD;
- file_handle.handle.fd = fd;
- file_handle.filename = SG(request_info).path_translated;
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- fclose(file_handle.handle.fp);
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- (void) php_execute_script(&file_handle CLS_CC ELS_CC);
- }
-
- php3_header(); /* Make sure headers have been sent */
- php_end_ob_buffering(1);
- return (OK);
-}
-
void php_save_umask()
{
saved_umask = umask(077);