mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
removed sapi/apache_hooks
This commit is contained in:
parent
51ca2dba53
commit
53349d69dd
@ -1,2 +0,0 @@
|
||||
Apache 1.3 (apache_hooks)
|
||||
Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar, George Schlossnagle, Lukas Schroeder
|
@ -1,206 +0,0 @@
|
||||
This is very beta documentation. Clearly better stuff can and will follow.
|
||||
|
||||
INTRO:
|
||||
|
||||
apache_hooks is a full super-set enhancement of the apache 1.3 sapi that allows for
|
||||
php code to be run on the apache request object at every stage of the apache
|
||||
request. It supports all of the apache 1.3 sapi commands and configurations, and
|
||||
additionally supports the following httpd.conf directives:
|
||||
|
||||
|
||||
HTTPD.CONF DIRECTIEVS:
|
||||
|
||||
phpRequire /path/to/file = requires a file at the beginning of an
|
||||
initial apache request
|
||||
|
||||
phpUriHandler /path/to/file = registers a hook that will run the
|
||||
specified file at the uri translation stage of the apache request
|
||||
phpUriHandler Class::Method = registers a hook to run Class::Method at
|
||||
the uri translation stage of the apache request
|
||||
|
||||
phpPostReadHandler /path/to/file = hook for post-read phase
|
||||
phpPostReadHandlerMethod Class::Method
|
||||
|
||||
phpHeaderHandler = hook for header parsing phase
|
||||
phpHeaderHandlerMethod
|
||||
|
||||
phpAuthHandler = hook for authentication phase
|
||||
phpAuthHandlerMethod
|
||||
|
||||
phpAccessHandler = hook for access control phase
|
||||
phpAccessHandlerMethod
|
||||
|
||||
phpTypeHandler = hook for Type Checking phase
|
||||
phpTypeHandlerMethod
|
||||
|
||||
phpFixupHandler = hook for 'fixup' phase
|
||||
phpFixupHandlerMethod
|
||||
|
||||
phpLoggerHandler = hook for logging phase
|
||||
phpLoggerHandlerMethod
|
||||
|
||||
AddHandler php-script = set's up a special type handler
|
||||
phpResponseHandler /path/to/file = sets file to be called to handle
|
||||
response phase
|
||||
phpResponseHandlerMethod Class::Method
|
||||
|
||||
|
||||
All handlers may be stacked, i.e. you can list multiple handler directives
|
||||
in a single scope and they will be run in order.
|
||||
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
So, to set up a 'hello world' location handler (so that any request to
|
||||
/hello/* returns hello world) you can:
|
||||
|
||||
phpRequire /tmp/setup.php
|
||||
<Location /hello>
|
||||
AddHandler php-script
|
||||
phpResponseHandlerMethod Hello::World
|
||||
</Location>
|
||||
|
||||
with
|
||||
#/tmp/setup.php
|
||||
<?
|
||||
class Hello {
|
||||
function World() {
|
||||
global $request;
|
||||
$request->send_http_header();
|
||||
echo "Hello World";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
$request is the apache request. It is instantiated at all stages
|
||||
automatically. The methods of that class are:
|
||||
|
||||
getallheaders
|
||||
args
|
||||
boundary
|
||||
content_encoding
|
||||
content_type
|
||||
filename
|
||||
handler
|
||||
hostname
|
||||
method
|
||||
path_info
|
||||
protocol
|
||||
status_line
|
||||
the_request
|
||||
unparsed_uri
|
||||
uri
|
||||
allowed
|
||||
bytes_sent
|
||||
chunked
|
||||
content_length
|
||||
header_only
|
||||
method_number
|
||||
mtime
|
||||
no_cache
|
||||
no_local_copy
|
||||
proto_num
|
||||
proxyreq
|
||||
read_body
|
||||
remaining
|
||||
request_time
|
||||
status
|
||||
headers_in
|
||||
headers_out
|
||||
err_headers_out
|
||||
auth_name
|
||||
auth_type
|
||||
basic_auth_pw
|
||||
discard_request_body
|
||||
is_initial_req
|
||||
meets_conditions
|
||||
remote_host
|
||||
satisfies
|
||||
server_port
|
||||
set_etag
|
||||
set_last_modified
|
||||
some_auth_required
|
||||
update_mtime
|
||||
send_http_header
|
||||
basic_http_header
|
||||
send_header_field
|
||||
send_http_trace
|
||||
send_http_options
|
||||
send_error_response
|
||||
set_content_length
|
||||
set_keepalive
|
||||
rputs
|
||||
log_error
|
||||
lookup_uri
|
||||
lookup_file
|
||||
method_uri
|
||||
run
|
||||
internal_redirect
|
||||
|
||||
|
||||
These all wrap the ap_* apache EXPORT_API functions using the same
|
||||
semantics (and are also the same as the Apache::Request methods in
|
||||
mod_perl if you are familiar with that)
|
||||
|
||||
So, a uri handler to redirect all non-local traffic to /404.php (an
|
||||
error page) would be
|
||||
|
||||
phpUriHandler /tmp/uri.php
|
||||
|
||||
#/tmp/uri.php
|
||||
<?
|
||||
if($REMOTE_ADDR != '127.0.0.1') {
|
||||
$request->uri('/404.php');
|
||||
}
|
||||
return OK;
|
||||
?>
|
||||
|
||||
It's important to note that since this is called from the uri
|
||||
translations phase, this validation is performed for every request to
|
||||
the server, not just for php pages.
|
||||
|
||||
Also, scope is shared between all the hooks. So in the above, we could
|
||||
merge the two and do something like:
|
||||
|
||||
#/tmp/uri.php
|
||||
<?
|
||||
if($REMOTE_ADDR != '127.0.0.1') {
|
||||
$whoami = 'Stranger';
|
||||
}
|
||||
else {
|
||||
$whoami = 'Friend';
|
||||
}
|
||||
return DECLINED; # because we're not redirecting, just messing around
|
||||
?>
|
||||
|
||||
and then:
|
||||
|
||||
#/tmp/setup.php
|
||||
<?
|
||||
class Hello {
|
||||
function World() {
|
||||
global $request;
|
||||
global $whoami;
|
||||
$request->send_http_header();
|
||||
echo "Hello $whoami";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
These variables are also in the same scope as a script if your script is
|
||||
being handled by the standard application/x-httpd-php handler.
|
||||
|
||||
This allows you to make decisions and pass data between your handlers
|
||||
and scripts at all stages.
|
||||
|
||||
The above are clearly trite examples, but hopefully give you a starting
|
||||
point.
|
||||
|
||||
One note: all handlers can be validly re-entered 'in sub-requests'.
|
||||
For this reason you should not define functions/classes here without
|
||||
anti-redefinition guards (I would just recommend putting them in an
|
||||
include and using include_one). This is not true for phpRequire, which
|
||||
is only entered once, at the main request, and so it is safe to make
|
||||
function/class declarations there (in fact that's what it's for).
|
||||
|
||||
Hope that helps!
|
@ -1,4 +0,0 @@
|
||||
This is a place-holder which indicates to Configure that it shouldn't
|
||||
provide the default targets when building the Makefile in this directory.
|
||||
Instead it'll just prepend all the important variable definitions, and
|
||||
copy the Makefile.tmpl onto the end.
|
@ -1,77 +0,0 @@
|
||||
##
|
||||
## Apache 1.3 Makefile template for PHP 4.0 Module
|
||||
## [src/modules/php7/Makefile.tmpl]
|
||||
##
|
||||
|
||||
# the parametrized target
|
||||
LIB=libphp7.$(LIBEXT)
|
||||
|
||||
# objects for building the static library
|
||||
OBJS=mod_php7.o
|
||||
OBJS_LIB=libmodphp7.a
|
||||
|
||||
# objects for building the shared object library
|
||||
SHLIB_OBJS=mod_php7.so-o
|
||||
SHLIB_OBJS_LIB=libmodphp7.a
|
||||
|
||||
# the general targets
|
||||
all: lib
|
||||
lib: $(LIB)
|
||||
|
||||
# build the static library by merging the object files
|
||||
libphp7.a: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
|
||||
libphp7.: $(OBJS) $(OBJS_LIB)
|
||||
cp $(OBJS_LIB) $@
|
||||
ar r $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
cp libphp7. libphp7.a
|
||||
|
||||
# build the shared object library by linking the object files
|
||||
libphp7.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
|
||||
rm -f $@
|
||||
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
|
||||
|
||||
# 1. extension .o for shared objects cannot be used here because
|
||||
# first these files aren't still shared objects and second we
|
||||
# have to use a different name to trigger the different
|
||||
# implicit Make rule
|
||||
# 2. extension -so.o (as used elsewhere) cannot be used because
|
||||
# the suffix feature of Make really wants just .x, so we use
|
||||
# extension .so-o
|
||||
.SUFFIXES: .o .so-o
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $<
|
||||
.c.so-o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
|
||||
|
||||
# cleanup
|
||||
clean:
|
||||
-rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
|
||||
|
||||
# We really don't expect end users to use this rule. It works only with
|
||||
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
|
||||
# using it.
|
||||
depend:
|
||||
cp Makefile.tmpl Makefile.tmpl.bak \
|
||||
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
|
||||
&& gcc -MM $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
|
||||
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
|
||||
> Makefile.tmpl \
|
||||
&& rm Makefile.new
|
||||
|
||||
#Dependencies
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
# DO NOT REMOVE
|
||||
mod_php7.o: mod_php7.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
|
||||
$(INCDIR)/buff.h \
|
||||
$(INCDIR)/http_config.h \
|
||||
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
|
||||
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
|
||||
$(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php7.h
|
@ -1,275 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
AC_DEFUN([PHP_APACHE_FD_CHECK], [
|
||||
AC_CACHE_CHECK([for member fd in BUFF *],ac_cv_php_fd_in_buff,[
|
||||
save=$CPPFLAGS
|
||||
if test -n "$APXS_INCLUDEDIR"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$APXS_INCLUDEDIR"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS $APACHE_INCLUDE"
|
||||
fi
|
||||
AC_TRY_COMPILE([#include <httpd.h>],[conn_rec *c; int fd = c->client->fd;],[
|
||||
ac_cv_php_fd_in_buff=yes],[ac_cv_php_fd_in_buff=no],[ac_cv_php_fd_in_buff=no])
|
||||
CPPFLAGS=$save
|
||||
])
|
||||
if test "$ac_cv_php_fd_in_buff" = "yes"; then
|
||||
AC_DEFINE(PHP_APACHE_HAVE_CLIENT_FD,1,[ ])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Apache 1.x shared module
|
||||
PHP_ARG_WITH(apache-hooks,,
|
||||
[ --with-apache-hooks[=FILE]
|
||||
EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
|
||||
pathname to the Apache apxs tool [apxs]], no, no)
|
||||
|
||||
AC_MSG_CHECKING([for Apache 1.x (hooks) module support via DSO through APXS])
|
||||
|
||||
if test "$PHP_APACHE_HOOKS" != "no"; then
|
||||
if test "$PHP_APACHE_HOOKS" = "yes"; then
|
||||
APXS=apxs
|
||||
$APXS -q CFLAGS >/dev/null 2>&1
|
||||
if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
|
||||
APXS=/usr/sbin/apxs
|
||||
fi
|
||||
else
|
||||
PHP_EXPAND_PATH($PHP_APACHE_HOOKS, APXS)
|
||||
fi
|
||||
|
||||
$APXS -q CFLAGS >/dev/null 2>&1
|
||||
if test "$?" != "0"; then
|
||||
AC_MSG_RESULT()
|
||||
AC_MSG_RESULT()
|
||||
AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
|
||||
AC_MSG_RESULT()
|
||||
AC_MSG_RESULT([1. Perl is not installed;])
|
||||
AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
|
||||
AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
|
||||
AC_MSG_RESULT([The output of $APXS follows])
|
||||
$APXS -q CFLAGS
|
||||
AC_MSG_ERROR([Aborting])
|
||||
fi
|
||||
|
||||
APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
|
||||
APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
|
||||
APXS_CFLAGS=`$APXS -q CFLAGS`
|
||||
APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
|
||||
APACHE_INCLUDE=-I$APXS_INCLUDEDIR
|
||||
|
||||
# Test that we're trying to configure with apache 1.x
|
||||
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
|
||||
if test "$APACHE_VERSION" -ge 2000000; then
|
||||
AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
|
||||
fi
|
||||
|
||||
for flag in $APXS_CFLAGS; do
|
||||
case $flag in
|
||||
-D*) APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag";;
|
||||
esac
|
||||
done
|
||||
|
||||
case $host_alias in
|
||||
*aix*)
|
||||
APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
|
||||
PHP_AIX_LDFLAGS="-Wl,-brtl"
|
||||
build_type=shared
|
||||
;;
|
||||
*darwin*)
|
||||
MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
|
||||
PHP_SUBST(MH_BUNDLE_FLAGS)
|
||||
SAPI_SHARED=libs/libphp7.so
|
||||
build_type=bundle
|
||||
;;
|
||||
*)
|
||||
build_type=shared
|
||||
;;
|
||||
esac
|
||||
|
||||
PHP_SELECT_SAPI(apache_hooks, $build_type, sapi_apache.c mod_php7.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
|
||||
|
||||
# Test whether apxs support -S option
|
||||
$APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
|
||||
|
||||
if test "$?" != "0"; then
|
||||
APACHE_HOOKS_INSTALL="$APXS -i -a -n php7 $SAPI_SHARED" # Old apxs does not have -S option
|
||||
else
|
||||
APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
|
||||
if test -z `$APXS -q SYSCONFDIR`; then
|
||||
APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
|
||||
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
|
||||
-i -n php7 $SAPI_SHARED"
|
||||
else
|
||||
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
|
||||
APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
|
||||
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
|
||||
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
|
||||
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
|
||||
-i -a -n php7 $SAPI_SHARED"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
|
||||
PHP_APXS_BROKEN=yes
|
||||
fi
|
||||
STRONGHOLD=
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
|
||||
AC_DEFINE(HAVE_APACHE_HOOKS,1,[ ])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Apache 1.x static module
|
||||
PHP_ARG_WITH(apache-hooks-static,,
|
||||
[ --with-apache-hooks-static[=DIR]
|
||||
EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
|
||||
build directory [/usr/local/apache]], no, no)
|
||||
|
||||
AC_MSG_CHECKING(for Apache 1.x (hooks) module support)
|
||||
|
||||
if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$PHP_APACHE_HOOKS_STATIC" != "no"; then
|
||||
|
||||
if test "$PHP_APACHE_HOOKS_STATIC" = "yes"; then
|
||||
# Apache's default directory
|
||||
PHP_APACHE_HOOKS_STATIC=/usr/local/apache
|
||||
fi
|
||||
|
||||
APACHE_HOOKS_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php7.* sapi/apache_hooks/libphp7.module"
|
||||
|
||||
AC_DEFINE(HAVE_APACHE,1,[ ])
|
||||
APACHE_HOOKS_MODULE=yes
|
||||
PHP_EXPAND_PATH($PHP_APACHE_HOOKS_STATIC, PHP_APACHE_HOOKS_STATIC)
|
||||
# For Apache 1.2.x
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/httpd.h; then
|
||||
APACHE_INCLUDE=-I$PHP_APACHE_HOOKS_STATIC/src
|
||||
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src
|
||||
PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
|
||||
APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
|
||||
PHP_LIBS="-L. -lphp3"
|
||||
AC_MSG_RESULT([yes - Apache 1.2.x])
|
||||
STRONGHOLD=
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
|
||||
fi
|
||||
# For Apache 2.0.x
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/include/httpd.h && test -f $PHP_APACHE_HOOKS_STATIC/srclib/apr/include/apr_general.h ; then
|
||||
AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
|
||||
# For Apache 1.3.x
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/src/main/httpd.h; then
|
||||
APACHE_HAS_REGEX=1
|
||||
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/main -I$PHP_APACHE_HOOKS_STATIC/src/os/unix -I$PHP_APACHE_HOOKS_STATIC/src/ap"
|
||||
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php7
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
|
||||
APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
|
||||
AC_MSG_RESULT([yes - Apache 1.3.x])
|
||||
STRONGHOLD=
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
|
||||
fi
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
|
||||
if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
|
||||
fi
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
|
||||
fi
|
||||
# Also for Apache 1.3.x
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/httpd.h; then
|
||||
APACHE_HAS_REGEX=1
|
||||
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/include -I$PHP_APACHE_HOOKS_STATIC/src/os/unix"
|
||||
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php7
|
||||
if test ! -d $APACHE_TARGET; then
|
||||
mkdir $APACHE_TARGET
|
||||
fi
|
||||
PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
|
||||
PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
|
||||
APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
|
||||
AC_MSG_RESULT([yes - Apache 1.3.x])
|
||||
STRONGHOLD=
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
|
||||
fi
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
|
||||
if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
|
||||
fi
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
|
||||
fi
|
||||
# For StrongHold 2.2
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/apache/httpd.h; then
|
||||
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/apache -I$PHP_APACHE_HOOKS_STATIC/ssl/include"
|
||||
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/apache
|
||||
PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
|
||||
PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
|
||||
APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
|
||||
STRONGHOLD=-DSTRONGHOLD=1
|
||||
AC_MSG_RESULT([yes - StrongHold])
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/apache/ap_config.h; then
|
||||
AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
|
||||
fi
|
||||
if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_compat.h; then
|
||||
AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
|
||||
if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
|
||||
AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
|
||||
fi
|
||||
elif test -f $PHP_APACHE_HOOKS_STATIC/src/compat.h; then
|
||||
AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([Invalid Apache directory - unable to find httpd.h under $PHP_APACHE_HOOKS_STATIC])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# compatibility
|
||||
if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
|
||||
enable_mod_charset=$with_mod_charset
|
||||
fi
|
||||
|
||||
PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option,
|
||||
[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no)
|
||||
|
||||
if test "$PHP_MOD_CHARSET" = "yes"; then
|
||||
AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ])
|
||||
fi
|
||||
|
||||
dnl Build as static module
|
||||
if test "$APACHE_HOOKS_MODULE" = "yes"; then
|
||||
PHP_TARGET_RDYNAMIC
|
||||
$php_shtool mkdir -p sapi/apache_hooks
|
||||
PHP_OUTPUT(sapi/apache_hooks/libphp7.module)
|
||||
fi
|
||||
|
||||
dnl General
|
||||
if test -n "$APACHE_HOOKS_INSTALL"; then
|
||||
if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
|
||||
APXS_EXP=-bE:sapi/apache_hooks/mod_php7.exp
|
||||
fi
|
||||
|
||||
PHP_APACHE_FD_CHECK
|
||||
INSTALL_IT=$APACHE_HOOKS_INSTALL
|
||||
|
||||
PHP_SUBST(APXS_EXP)
|
||||
PHP_SUBST(APACHE_INCLUDE)
|
||||
PHP_SUBST(APACHE_TARGET)
|
||||
PHP_SUBST(APXS)
|
||||
PHP_SUBST(APXS_LDFLAGS)
|
||||
PHP_SUBST(APACHE_HOOKS_INSTALL)
|
||||
PHP_SUBST(STRONGHOLD)
|
||||
fi
|
||||
|
||||
dnl ## Local Variables:
|
||||
dnl ## tab-width: 4
|
||||
dnl ## End:
|
@ -1,21 +0,0 @@
|
||||
// vim:ft=javascript
|
||||
// $Id$
|
||||
|
||||
ARG_WITH('apache-hooks', 'Build Apache 1.3.x (hooks) version of PHP', 'no');
|
||||
|
||||
if (PHP_APACHE_HOOKS != "no") {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE_HOOKS", php_usual_include_suspects +
|
||||
";" + PROGRAM_FILES + "\\Apache Group\\Apache\\include" +
|
||||
";" + PHP_PHP_BUILD + "\\apache\\src\\include") &&
|
||||
CHECK_LIB("ApacheCore.lib", "apache_hooks", php_usual_lib_suspects +
|
||||
';' + PROGRAM_FILES + '\\Apache Group\\Apache\\libexec' +
|
||||
";" + PHP_PHP_BUILD + "\\apache\\src\\corer")) {
|
||||
// We need to play tricks to get our readdir.h used by apache
|
||||
// headers
|
||||
SAPI('apache_hooks', 'mod_php7.c sapi_apache.c php_apache.c',
|
||||
'php' + PHP_VERSION + 'apache_hooks.dll',
|
||||
'/D APACHEPHP7_EXPORTS /D APACHE_READDIR_H /I win32');
|
||||
} else {
|
||||
WARNING("Could not find apache libraries/headers");
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
Name: php7_module
|
||||
ConfigStart
|
||||
RULE_WANTHSREGEX=no
|
||||
RULE_HIDE=yes
|
||||
PHP_LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS"
|
||||
PHP_CFLAGS="$CFLAGS @OPENSSL_INCDIR_OPT@ -I@php_abs_top_builddir@/main -I@php_abs_top_builddir@/Zend -I@php_abs_top_builddir@/TSRM -I@php_abs_top_srcdir@ -I@php_abs_top_srcdir@/sapi/apache -I@php_abs_top_srcdir@/main -I@php_abs_top_srcdir@/Zend -I@php_abs_top_srcdir@/TSRM"
|
||||
my_outfile="Makefile.config"
|
||||
echo "PHP_CFLAGS=$PHP_CFLAGS" >>$my_outfile
|
||||
echo "PHP_LIBS=$PHP_LIBS" >>$my_outfile
|
||||
LIBS=$PHP_LIBS
|
||||
ConfigEnd
|
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
php7_module
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.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. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Rasmus Lerdorf <rasmus@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef MOD_PHP7_H
|
||||
#define MOD_PHP7_H
|
||||
|
||||
#if !defined(WIN32) && !defined(WINNT)
|
||||
#ifndef MODULE_VAR_EXPORT
|
||||
#define MODULE_VAR_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
long engine;
|
||||
long last_modified;
|
||||
long xbithack;
|
||||
long terminate_child;
|
||||
long setup_env;
|
||||
long current_hook;
|
||||
zend_bool in_request;
|
||||
zend_bool apache_config_loaded;
|
||||
zend_bool headers_sent;
|
||||
} php_apache_info_struct;
|
||||
|
||||
typedef struct _php_handler {
|
||||
long type;
|
||||
long stage;
|
||||
char *name;
|
||||
} php_handler;
|
||||
|
||||
#define AP_HANDLER_TYPE_FILE 0
|
||||
#define AP_HANDLER_TYPE_METHOD 1
|
||||
|
||||
extern zend_module_entry apache_module_entry;
|
||||
|
||||
#ifdef ZTS
|
||||
extern int php_apache_info_id;
|
||||
#define AP(v) TSRMG(php_apache_info_id, php_apache_info_struct *, v)
|
||||
#else
|
||||
extern php_apache_info_struct php_apache_info;
|
||||
#define AP(v) (php_apache_info.v)
|
||||
#endif
|
||||
|
||||
/* defines for the various stages of the apache request */
|
||||
#define AP_WAITING_FOR_REQUEST 0
|
||||
#define AP_POST_READ 1
|
||||
#define AP_URI_TRANS 2
|
||||
#define AP_HEADER_PARSE 3
|
||||
#define AP_ACCESS_CONTROL 4
|
||||
#define AP_AUTHENTICATION 5
|
||||
#define AP_AUTHORIZATION 6
|
||||
#define AP_TYPE_CHECKING 7
|
||||
#define AP_FIXUP 8
|
||||
#define AP_RESPONSE 9
|
||||
#define AP_LOGGING 10
|
||||
#define AP_CLEANUP 11
|
||||
|
||||
|
||||
/* fix for gcc4 visibility patch */
|
||||
#ifndef PHP_WIN32
|
||||
# undef MODULE_VAR_EXPORT
|
||||
# define MODULE_VAR_EXPORT PHPAPI
|
||||
#endif
|
||||
|
||||
#endif /* MOD_PHP7_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
@ -1 +0,0 @@
|
||||
php7_module
|
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
#define NO_REGEX_EXTRA_H
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_stack.h"
|
||||
#include "ext/ereg/php_regex.h"
|
||||
|
||||
#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 "util_script.h"
|
||||
|
||||
#include "php_variables.h"
|
||||
#include "php_main.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/php_standard.h"
|
||||
|
||||
#include "mod_php7.h"
|
||||
|
||||
|
||||
zval *php_apache_request_new(request_rec *r);
|
||||
|
||||
int apache_php_module_hook(request_rec *r, php_handler *handler, zval **ret);
|
@ -1,131 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2015 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.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@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include "php_apache_http.h"
|
||||
|
||||
/* {{{ apache_php_module_main
|
||||
*/
|
||||
int apache_php_module_main(request_rec *r, int display_source_mode)
|
||||
{
|
||||
zend_file_handle file_handle;
|
||||
|
||||
if (php_request_startup() == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
/* sending a file handle to another dll is not working
|
||||
so let zend open it. */
|
||||
|
||||
if (display_source_mode) {
|
||||
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
||||
|
||||
php_get_highlight_struct(&syntax_highlighter_ini);
|
||||
if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini)){
|
||||
return OK;
|
||||
} else {
|
||||
return NOT_FOUND;
|
||||
}
|
||||
} else {
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.handle.fd = 0;
|
||||
file_handle.filename = SG(request_info).path_translated;
|
||||
file_handle.opened_path = NULL;
|
||||
file_handle.free_filename = 0;
|
||||
(void) php_execute_script(&file_handle);
|
||||
}
|
||||
AP(in_request) = 0;
|
||||
|
||||
return (OK);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ apache_php_module_hook
|
||||
*/
|
||||
int apache_php_module_hook(request_rec *r, php_handler *handler, zval **ret)
|
||||
{
|
||||
zend_file_handle file_handle;
|
||||
zval *req;
|
||||
char *tmp;
|
||||
|
||||
#if PHP_SIGCHILD
|
||||
signal(SIGCHLD, sigchld_handler);
|
||||
#endif
|
||||
if(AP(current_hook) == AP_RESPONSE) {
|
||||
if (php_request_startup_for_hook() == FAILURE)
|
||||
return FAILURE;
|
||||
}
|
||||
else {
|
||||
if (php_request_startup_for_hook() == FAILURE)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
req = php_apache_request_new(r);
|
||||
php_register_variable_ex("request", req, PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
|
||||
switch(handler->type) {
|
||||
case AP_HANDLER_TYPE_FILE:
|
||||
php_register_variable("PHP_SELF_HOOK", handler->name, PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
memset(&file_handle, 0, sizeof(file_handle));
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.filename = handler->name;
|
||||
(void) php_execute_simple_script(&file_handle, ret);
|
||||
break;
|
||||
case AP_HANDLER_TYPE_METHOD:
|
||||
if( (tmp = strstr(handler->name, "::")) != NULL && *(tmp+2) != '\0' ) {
|
||||
zval *class;
|
||||
zval *method;
|
||||
*tmp = '\0';
|
||||
ALLOC_ZVAL(class);
|
||||
ZVAL_STRING(class, handler->name, 1);
|
||||
ALLOC_ZVAL(method);
|
||||
ZVAL_STRING(method, tmp +2, 1);
|
||||
*tmp = ':';
|
||||
call_user_function_ex(EG(function_table), &class, method, ret, 0, NULL, 0, NULL);
|
||||
zval_dtor(class);
|
||||
zval_dtor(method);
|
||||
}
|
||||
else {
|
||||
php_error(E_ERROR, "Unable to call %s - not a Class::Method\n", handler->name);
|
||||
/* not a class::method */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* not a valid type */
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
zval_dtor(req);
|
||||
AP(in_request) = 0;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
Loading…
Reference in New Issue
Block a user