]> granicus.if.org Git - php/commitdiff
* Get Apache to work. POST doesn't work yet.
authorZeev Suraski <zeev@php.net>
Tue, 11 May 1999 00:01:47 +0000 (00:01 +0000)
committerZeev Suraski <zeev@php.net>
Tue, 11 May 1999 00:01:47 +0000 (00:01 +0000)
* There are now -I directives for the absolute path of php4, php4/libzend and the builddir for
  the Apache module, so we can #include any php/Zend header.
* Rename config.h to php_config.h

30 files changed:
Makefile.in
configure.in.in
ext/ereg/ereg.c
ext/ereg/php_regex.h [new file with mode: 0644]
ext/gd/gdcache.c
ext/gd/gdttf.c
ext/hyperwave/dlist.c
ext/hyperwave/hg_comm.c
ext/hyperwave/hw.c
ext/interbase/interbase.c
ext/odbc/odbc.c
ext/pgsql/pgsql.c
ext/standard/browscap.c
ext/standard/post.c
ext/standard/reg.c
ext/standard/url.c
ext/sybase/sybase-ct.c
ext/sybase/sybase.c
ext/sysvsem/sysvsem.c
ext/sysvshm/sysvshm.c
genif.sh
libphp3.module.in
main/alloca.c
main/main.c
main/php.h
main/php_regex.h [new file with mode: 0644]
main/snprintf.c
mod_php3.c
php3_sprintf.c
request_info.c

index 10af29153b64f56b9876218a43389bf9a5f4bf19..4a7e9e3296101da26a509fd09cb3785411ec44d0 100644 (file)
@@ -124,7 +124,7 @@ clean: clean-recursive
 distclean: clean distclean-recursive
        -rm -f *-parser.[ch] *-scanner.c *.output
        -rm -f config.status config.cache config.log
-       -rm -f Makefile Makefile.depend config.h build-defs.h
+       -rm -f Makefile Makefile.depend php_config.h build-defs.h
        -rm -f libphp3.module stamp-h
        -rm -f regex/*.o regex/*.a regex/*.ih
        -rm -f doc/checkdoc doc/funcparse doc/version.ent
@@ -144,8 +144,8 @@ regression check: $(BINNAME)
 config.status: configure
        ./config.status --recheck
 
-build-defs.h config.h: stamp-h
-stamp-h: config.h.in config.status
+build-defs.h php_config.h: stamp-h
+stamp-h: php_config.h.in config.status
        CONFIG_FILES='build-defs.h stamp-h' ./config.status
 
 Makefile: Makefile.in config.status
@@ -158,7 +158,7 @@ Makefile: Makefile.in config.status
 configure: @MAINT@ configure.in aclocal.m4
        cd $(srcdir) && autoconf
 
-config.h.in: @MAINT@ stamp-h.in
+php_config.h.in: @MAINT@ stamp-h.in
 stamp-h.in: configure.in aclocal.m4 acconfig.h
        cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
 
index 9ea289df70ce558738d867dba325160d7d7b51c7..193ffd19e78546df5dc1e321ffa2b30de64ab2ae 100644 (file)
@@ -57,7 +57,7 @@ else
 fi
 AC_SUBST(PHP_VERSION)
 
-AM_CONFIG_HEADER(config.h)
+AM_CONFIG_HEADER(php_config.h)
 AM_MAINTAINER_MODE
 
 dnl We want this one before the checks, so the checks can modify CFLAGS.
@@ -348,8 +348,12 @@ AC_ARG_WITH(apxs,
 ])
 
 
-APACHE_INSTALL_FILES="$srcdir/mod_php3.* $srcdir/php_version.h libphp3.module $srcdir/SAPI.h"
+APACHE_INSTALL_FILES="$srcdir/mod_php3.* libphp3.module"
 
+abs_srcdir=`(cd $srcdir; pwd)`
+abs_builddir=`pwd`
+AC_SUBST(abs_srcdir)
+AC_SUBST(abs_builddir)
 
 AC_MSG_CHECKING(for Apache module support via DSO through APACI)
 AC_ARG_WITH(shared-apache,
@@ -876,7 +880,7 @@ chmod +x scripts/mkextlib
 echo "creating internal_functions.c"
 extensions=\`grep '^s.@EXT_SUBDIRS@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\`
 mv -f internal_functions.c internal_functions.c.old 2>/dev/null
-sh $srcdir/genif.sh $srcdir/internal_functions.c.in \$srcdir \$extensions > internal_functions.c
+sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c
 if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then
     echo "internal_functions.c is unchanged"
     mv internal_functions.c.old internal_functions.c
index 9b7bbd189949bbeb1bab288d67cf2c08c7ca95c9..4c8b1e240e5cec6b3eb6a6673038bece4f7d4b5e 100644 (file)
@@ -33,6 +33,7 @@
 #include <stdio.h>
 #include "php.h"
 #include "php3_string.h"
+#include "php_regex.h"
 #include "reg.h"
 
 unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
new file mode 100644 (file)
index 0000000..2d18db7
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _PHP_REGEX_H
+#define _PHP_REGEX_H
+
+#if REGEX
+#include "regex/regex.h"
+#define _REGEX_H 1                             /* this should stop Apache from loading the system version of regex.h */
+#define _RX_H 1                                        /* Try defining these for Linux to      */
+#define __REGEXP_LIBRARY_H__ 1         /* avoid Apache including regex.h       */
+#define _H_REGEX 1              /* This one is for AIX */
+#else
+#include <regex.h>
+#endif
+
+#endif /* _PHP_REGEX_H */
\ No newline at end of file
index 3fd82dea70fc9c6260e8d7e77628fa0a7015600a..1662ebb184db5216602ce6f58fe3b4ca1c9165fc 100644 (file)
@@ -40,7 +40,7 @@
 #if (WIN32|WINNT)
 #define HAVE_LIBTTF 1
 #else
-#include "config.h"
+#include "php_config.h"
 #endif
 #if HAVE_LIBTTF
 
index 39e93ed3390f3938e9ac7a1b0a21b4675445a7e4..93bb3528d1be519f6f2ce36edb4ff4d753b6ec83 100644 (file)
@@ -7,7 +7,7 @@
 #if WIN32|WINNT
 #include "config.w32.h"
 #else
-#include "config.h"
+#include "php_config.h"
 #endif
 #if HAVE_LIBTTF
 #include <stdio.h>
index 27c13056645e65d4301f20ba5b5b5cda984bcc2e..94dd6edf7bb3deb70063e1e6da83baaf20178eba 100644 (file)
@@ -18,6 +18,9 @@
 * -----------------
 *
 * $Log$
+* Revision 1.1  1999/04/21 23:11:20  ssb
+* moved apache, com and hyperwave into ext/
+*
 * Revision 1.1.1.1  1999/04/07 21:03:31  zeev
 * PHP 4.0
 *
@@ -48,7 +51,7 @@
 ****************************************************************************/
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 
 #if HYPERWAVE
index eb10f00f19525c833ef2b35549278cce06eca06b..9250e2097088ced79114e1ff14a6e223e180f341 100644 (file)
@@ -32,7 +32,7 @@
 #if WIN32|WINNT
 #include "win95nt.h"
 #else
-#include "config.h"
+#include "php_config.h"
 #endif
 
 #if HYPERWAVE
index dcee8874d5d48b9af7db3dced83b9f471fa7ae47..570e4155975138e637b32ee21580773a7afd79a3 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdlib.h>
 
 #if !(WIN32|WINNT)
-#include "config.h"
+#include "php_config.h"
 #endif
 #include "php.h"
 #include "ext/standard/head.h"
index 1cc8aa530b46ac7a94ccd2e6e502ffe57c8f4e3d..9ad4507c7950087e35b525d3cf29a389191b4518 100644 (file)
@@ -32,7 +32,7 @@
 
 /* TODO: A lot... */
 
-#include "config.h"
+#include "php_config.h"
 #include "php.h"
 #include "php3_interbase.h"
 
index 3af8798c5586d0af6f9ce76bb1f6a09da987c141..e78a6d4b91ca1fdf3d233c1866f8a6c9d5dabe3a 100644 (file)
@@ -41,7 +41,7 @@
 #if HAVE_UODBC
 
 # if !(WIN32|WINNT)
-#  include "config.h"
+#  include "php_config.h"
 #  include "build-defs.h"
 # endif
   
index fa38715d253a5f988432c5e610abf332682f7986..1d34c2349f655efb6162ef65866d58ee0b023908 100644 (file)
@@ -33,7 +33,7 @@
 #include <stdlib.h>
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 #include "php.h"
 #include "php3_pgsql.h"
index f6bc5e80a3127ceec887495ff8dda89143dd4529..95136da331dc0f830e38d6ea85b825acdf9eba2a 100644 (file)
@@ -30,6 +30,7 @@
 #include "php.h"
 #include "php3_browscap.h"
 #include "php_ini.h"
+#include "php_regex.h"
 
 #include "zend_globals.h"
 
index 52260585d938d4bc0256e82919f98a9907282085..8258493213432d3ae137f381b8fda43f3347b485 100644 (file)
@@ -320,7 +320,7 @@ void php3_treat_data(int arg, char *str)
 {
        char *res = NULL, *var, *val;
        pval *array_ptr;
-       int free_buffer;
+       int free_buffer=0;
        ELS_FETCH();
        PLS_FETCH();
        SLS_FETCH();
index 9b7bbd189949bbeb1bab288d67cf2c08c7ca95c9..4c8b1e240e5cec6b3eb6a6673038bece4f7d4b5e 100644 (file)
@@ -33,6 +33,7 @@
 #include <stdio.h>
 #include "php.h"
 #include "php3_string.h"
+#include "php_regex.h"
 #include "reg.h"
 
 unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
index a44f01a4dce8b15742259427eac12fa81b9c34fc..e5acd6c578174410a6cf2edb724b1f1b5d28fadf 100644 (file)
@@ -33,8 +33,8 @@
 #include <ctype.h>
 #include <sys/types.h>
 
-/* php.h includes the correct regex.h */
 #include "php.h"
+#include "php_regex.h"
 
 #include "url.h"
 #ifdef _OSD_POSIX
index 58ba286bad177df690bad8ba92e8004eacea89be..a07c1994ecfbce0d08cfb7823229a41adadd684e 100644 (file)
@@ -32,7 +32,7 @@
 
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 #include "php.h"
 #include "php3_sybase-ct.h"
index 94a8c9ccd11fcc712ae4527cad41c13cfe1ffbf2..f52790227fa06326df7745122cc1f3806948cb38 100644 (file)
@@ -35,7 +35,7 @@
 
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 #include "php.h"
 #include "php3_sybase.h"
index 2c2a9ccbc0627a53a750d8a46823f5187df4e8c7..4107f1477cb4371508da622aa124d8a179835047 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 
 #if HAVE_SYSVSEM
index 68547281c568ddda2aab6255a12bd7d020640844..88678478c74511c9772a5e010f37008c45753c40 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #ifndef MSVC5
-#include "config.h"
+#include "php_config.h"
 #endif
 
 
index b074f84ed804562ee7756bacc5e97c06cfd6197a..b04486bf83d1f433c390ef598257ed3f4e6c00ae 100644 (file)
--- a/genif.sh
+++ b/genif.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $Id: genif.sh,v 1.4 1999-05-08 22:00:02 sas Exp $
+# $Id: genif.sh,v 1.5 1999-05-11 00:01:41 zeev Exp $
 # replacement for genif.pl
 
 infile="$1"
@@ -20,7 +20,7 @@ for ext in ${1+"$@"} ; do
        module_ptrs="   phpext_${ext}_ptr,\\\n$module_ptrs"
        for pre in php3 php php4 zend; do
                hdrfile="ext/$ext/${pre}_${ext}.h"
-               if test -f $hdrfile ; then
+               if test -f "$srcdir/$hdrfile" ; then
                        includes="#include \"$hdrfile\"\\\n$includes"
                fi
        done
index b7628349811029dbf8a448b77f2b1b94f6673212..5b234bf8759e12c2dfa6e7a1148689cb0752cbb0 100644 (file)
@@ -3,5 +3,5 @@ ConfigStart
        RULE_WANTHSREGEX=@HSREGEX@
        LIBS="@PHP_LIBS@ @EXTRA_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS"
        RULE_HIDE=yes
-ConfigEnd
-
+       CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/libzend -I@abs_builddir@"
+ConfigEnd
\ No newline at end of file
index aa512d9a1cdaf79078a51500319674d6471c1bd6..a520f2c834721880f79c1a85dc3337689e45c518 100644 (file)
@@ -21,7 +21,7 @@
    allocating any.  It is a good idea to use alloca(0) in
    your main control loop, etc. to force garbage collection.  */
 
-#include <config.h>
+#include "php_config.h"
 
 #if !HAVE_ALLOCA
 
index 1f3303304d139fe4d457bd171f8d2fb881e3b184..006032f498eb4328bcd91992d609a0be8f66bcea 100644 (file)
@@ -921,6 +921,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                        case 'g':
                        case 'G':
                                if (!_gpc_flags[2]) {
+                                       printf("Parsing GET data:  '%s'\n", SG(request_info).query_string);
                                        php3_treat_data(PARSE_GET, NULL);       /* GET Data */
                                        _gpc_flags[2]=1;
                                }
@@ -1188,7 +1189,7 @@ PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_
 /* some systems are missing these from their header files */
 
 #if APACHE
-PHPAPI int apache_php3_module_main(request_rec *r, int fd, int display_source_mode)
+PHPAPI int apache_php3_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
 {
        zend_file_handle file_handle;
 #ifdef ZTS
@@ -1201,8 +1202,6 @@ PHPAPI int apache_php3_module_main(request_rec *r, int fd, int display_source_mo
 #endif
        SLS_FETCH();
 
-       SG(server_context) = r;
-
        if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
                return FAILURE;
        }
index f40528ea0024b1adbb53458bb8d72c82417c068f..e7df9ae5ad28fd1ec0473c04cc0d864d1bbd02e2 100644 (file)
@@ -75,7 +75,7 @@ extern unsigned char second_arg_allow_ref[];
 #      define PHPAPI __declspec(dllimport) 
 #      endif
 #else
-#include "config.h"
+#include "php_config.h"
 #define PHPAPI
 #define THREAD_LS
 #endif
@@ -151,16 +151,6 @@ typedef zval pval;
 #define pval_copy_constructor  zval_copy_ctor
 #define pval_destructor                        zval_dtor
 
-#if REGEX
-#include "regex/regex.h"
-#define _REGEX_H 1                             /* this should stop Apache from loading the system version of regex.h */
-#define _RX_H 1                                        /* Try defining these for Linux to      */
-#define __REGEXP_LIBRARY_H__ 1         /* avoid Apache including regex.h       */
-#define _H_REGEX 1              /* This one is for AIX */
-#else
-#include <regex.h>
-#endif
-
 #if STDC_HEADERS
 # include <string.h>
 #else
diff --git a/main/php_regex.h b/main/php_regex.h
new file mode 100644 (file)
index 0000000..2d18db7
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _PHP_REGEX_H
+#define _PHP_REGEX_H
+
+#if REGEX
+#include "regex/regex.h"
+#define _REGEX_H 1                             /* this should stop Apache from loading the system version of regex.h */
+#define _RX_H 1                                        /* Try defining these for Linux to      */
+#define __REGEXP_LIBRARY_H__ 1         /* avoid Apache including regex.h       */
+#define _H_REGEX 1              /* This one is for AIX */
+#else
+#include <regex.h>
+#endif
+
+#endif /* _PHP_REGEX_H */
\ No newline at end of file
index 32bff374e2d811a868767e46f2ebde26b9c4cf35..9c6a552f617e83f316730081c251ec4eb2fd910c 100644 (file)
@@ -53,7 +53,7 @@
  * <panos@alumni.cs.colorado.edu> for xinetd.
  */
 
-#include "config.h"
+#include "php_config.h"
 
 #if !defined(APACHE) || (!APACHE)
 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
index 01bdd8d73da3eb18dd2b3aa30f7fea67ceae17d0..85451001b408164626b04d6cec77210a016d4695 100644 (file)
@@ -25,7 +25,7 @@
    +----------------------------------------------------------------------+
    | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca>                       |
    | (with helpful hints from Dean Gaudet <dgaudet@arctic.org>            |
-   | PHP4 patches by Zeev Suraski <zeev@zend.com>                         |
+   | PHP 4.0 patches by Zeev Suraski <zeev@zend.com>                      |
    +----------------------------------------------------------------------+
  */
 /* $Id$ */
 #include "http_protocol.h"
 #include "http_request.h"
 #include "http_log.h"
-#include "SAPI.h"
-
-
-/* These are taken out of php_ini.h
- * they must be updated if php_ini.h changes!
- */
-#define PHP_INI_USER    (1<<0)
-#define PHP_INI_PERDIR  (1<<1)
-#define PHP_INI_SYSTEM  (1<<2)
 
-/* These are taken out of main.h
- * they must be updated if main.h changes!
- */
-
-int apache_php3_module_main(request_rec * r, int fd, int display_source_mode);
-int php_module_startup(sapi_module_struct *sf);
-void php_module_shutdown();
-void php_module_shutdown_for_exec();
-int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
-
-int php3_error(int type, const char *format, ...);
+#include "php.h"
+#include "php_ini.h"
+#include "SAPI.h"
+#include "main.h"
 
 #include "util_script.h"
 
@@ -74,6 +58,8 @@ int php3_error(int type, const char *format, ...);
 # include "mod_dav.h"
 #endif
 
+PHPAPI int apache_php3_module_main(request_rec *r, int fd, int display_source_mode SLS_DC);
+
 /* ### these should be defined in mod_php3.h or somewhere else */
 #define USE_PATH 1
 #define IGNORE_URL 2
@@ -120,15 +106,15 @@ static int zend_apache_ub_write(const char *str, uint str_length)
 }
 
 
-char *sapi_apache_read_post(SLS_D)
+int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC)
 {
-       return NULL;
+       return 0;
 }
 
 
 char *sapi_apache_read_cookies(SLS_D)
 {
-       return table_get(r->subprocess_env, "HTTP_COOKIE");
+       return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
 }
 
 
@@ -146,11 +132,11 @@ int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
 
        *p = 0;
        do {
-               header_content++
+               header_content++;
        } while (*header_content==' ');
 
        if (!strcasecmp(header_name, "Content-Type")) {
-               r->content_type = pstrdup(header_content);
+               r->content_type = pstrdup(r->pool, header_content);
        } else if (!strcasecmp(header_name, "Location")) {
                r->status = REDIRECT;
        } else {
@@ -163,7 +149,7 @@ int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
 }
 
 
-void sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
+int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
 {
        send_http_header((request_rec *) SG(server_context));
        return SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -195,9 +181,24 @@ void php3_restore_umask()
 }
 
 
+static void init_request_info(SLS_D)
+{
+       request_rec *r = ((request_rec *) SG(server_context));
+       char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
+
+       SG(request_info).query_string = r->args;
+       SG(request_info).path_translated = r->filename;
+       SG(request_info).request_uri = r->uri;
+       SG(request_info).request_method = r->method;
+       SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
+       SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+}
+
+
 int send_php3(request_rec *r, int display_source_mode, char *filename)
 {
        int fd, retval;
+       SLS_FETCH();
 
        /* We don't accept OPTIONS requests, but take everything else */
        if (r->method_number == M_OPTIONS) {
@@ -251,11 +252,15 @@ int send_php3(request_rec *r, int display_source_mode, char *filename)
        /* Init timeout */
        hard_timeout("send", r);
 
+       SG(server_context) = r;
+       init_request_info(SLS_C);
+       
        php3_save_umask();
        chdir_file(filename);
        add_common_vars(r);
        add_cgi_vars(r);
-       apache_php3_module_main(r, fd, display_source_mode);
+       init_request_info();
+       apache_php3_module_main(r, fd, display_source_mode SLS_CC);
 
        /* Done, restore umask, turn off timeout, close file and return */
        php3_restore_umask();
index f90a46b356e551cd7f4a3db697db1a2b0992d326..8f34b29cabc38d57cce38c94cbca804aef9beec2 100644 (file)
@@ -30,7 +30,7 @@
 
 /* $Id$ */
 
-#include "config.h"
+#include "php_config.h"
 #include <stdio.h>
 #include <stdarg.h>
 
index 884b184c31a780b4737bbe9145ea5597a44d75fc..5ed42393b5a4d66d7c2fe4f30d8896f2b8a971a3 100644 (file)
@@ -92,23 +92,13 @@ int php3_destroy_request_info(void *conf)
 #if APACHE
 int php3_init_request_info(void *conf)
 {
-       const char *buf;
        request_rec *r;
        SLS_FETCH();
 
        r = ((request_rec *) SG(server_context));
-       SG(request_info).query_string = r->args;
-       SG(request_info).path_translated = r->filename;
-       SG(request_info).request_uri = r->uri;
        request_info.current_user = NULL;
        request_info.current_user_length = 0;
-
        request_info.filename = r->filename;
-       SG(request_info).request_method = r->method;
-       SG(request_info).content_type = table_get(r->subprocess_env, "CONTENT_TYPE");
-
-       buf = table_get(r->subprocess_env, "CONTENT_LENGTH");
-       SG(request_info).content_length = (buf ? atoi(buf) : 0);
 
        return SUCCESS;
 }