This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: Pre-ITP: apache/mod_php
Reini Urban wrote:
> that's a problem I avoided so far.
> officially they cannot coexist under /usr/lib/php,
> but the extension_dir is seperated and the dll naming is versioned.
That's why I plan to use "php4" explicitly everywhere up front.
> officially the .ini is at /usr/lib/php/
Config files live in /etc. I don't care what the brain dead PHP way is.
> you confused me :)
> let me explain. cygphp4.dll is the shared master php library (there's no
> /usr/lib/libphp4.a), and there exist various sapi interfaces to
> communicate between the server and the cygphp4.dll.
> stipe had just one big /usr/lib/apache/libphp4.dll, which was the apache
> module and the php lib together. the cgi and cli couldn't use it.
>
> the call path is like this:
> /usr/sbin/httpd.exe => /usr/lib/apache/mod_php4.dll
> /usr/lib/apache/mod_php4.dll => /usr/bin/cygphp4.dll
> /usr/bin/cygphp4.dll => <extension_dir>/php_<ext>.dll
>
> /usr/bin/php.exe => /usr/bin/cygphp4.dll
> ...
> /usr/lib/php/bin/php.exe => /usr/bin/cygphp4.dll
You keep mentioning this split, between cygphp4.dll and mod_php4.dll but
you either must be making it up or it's something new in php5. The php4
build system generates no such thing, nor can I see a way to make it do
so. The build system builds the SAPI DSO (cygphp4.dll / libphp4.so) and
the binary (php.exe / php), with no intermediate common libraries. I
see no way to make it do what you say above.
Here is the quick summary of how Debian has packaged php4. I like to
default to Debian in terms of questions of paths and packages, since I
know they have put a great deal of thought into offering multiple
versions (they simultaneously support 3.x, 4.x, and 5.x) and they try
hard to adhere to the FHS.
php4:
depends: (libapache-mod-php4 or libapache2-mod-php4
or caudium-php4) php4-common
files: none
php4-common:
depends: none
files: /usr/share/doc/php4-common/* /etc/cron.d/php4
php4-cgi:
depends: php4-common php4-cli
recommends: php4-pear
suggests: phpdoc
files: /usr/lib/cgi-bin/php4 (2.7MB, no other php lib dependencies)
php4-cli:
depends: php4-common
recommends: php4-pear
suggests: phpdoc
files: /usr/bin/php4 (2.7MB, no other php lib dependencies)
php4-pear:
depends: php4-common php4-cli
suggests: php4-dev
files: /usr/bin/pear /usr/share/php/* (PEAR stuff)
php4-dev:
depends: php4-common
files: /usr/bin/{ext_skel,php-config,phpextdist,phpize}
/usr/include/php4/* /usr/lib/php4/{build,skeleton}/*
libapache-mod-php4:
depends: php4-common
suggests: php4-pear phpdoc
files: /usr/lib/apache/libphp4.so
phpdoc:
depends: none
files: /usr/share/doc/phpdoc/* (php manual in html)
configs:
/etc/php4/apache/php.ini
/etc/php4/cgi/php.ini
/etc/pear/pear.conf
extensions:
/usr/lib/php4/20020429/*.so
I know that this deviates from the "stock PHP way" in a number of
aspects. However, the more I learn about it the more I loathe the
"stock PHP way" as it's just broken.
For the purposes of Cygwin, I'm not sure if I want that number of
seperate packages. What I had in mind was a single package for the CLI
binary, headers, build stuff, PEAR, and possibly a postinstall that
installs it as a CGI if you don't have mod_php4 installed. I don't know
whether I'd call this "php4" or "php4-cli". And I think I'll skip
including the entire manual, you can get that from their site.
> couldn't you make your gbs and patch avialable somewhere, so that we
> (gerrit and me), can try it out? and try to add as much extensions as
> possible.
I already posted my first set of patches to the other thread on main
cygwin list. Attached is a better version, it eliminates a couple of
redundant changes I made, and uses the noX libXpm if present.
Brian
Index: Makefile.global
===================================================================
RCS file: /var/lib/cvsroot/php4/Makefile.global,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.global
--- Makefile.global 24 Sep 2004 09:58:26 -0000 1.1.1.1
+++ Makefile.global 24 Sep 2004 12:47:09 -0000
@@ -14,9 +14,9 @@
build-modules: $(PHP_MODULES)
-libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
- -@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
+$(OVERALL_TARGET): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
+ $(CC) -shared $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) /usr/bin/libhttpd.dll -o $@
+ -@$(LIBTOOL) --silent --mode=install cp $(OVERALL_TARGET) $(phptempdir)/$(OVERALL_TARGET) >/dev/null 2>&1
libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
@@ -40,7 +40,6 @@
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
- @rm -f modules/*.la >/dev/null 2>&1
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
install-tester:
@@ -67,7 +66,7 @@
find . -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
- rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
+ rm -f $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
Index: acinclude.m4
===================================================================
RCS file: /var/lib/cvsroot/php4/acinclude.m4,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 acinclude.m4
--- acinclude.m4 24 Sep 2004 09:58:26 -0000 1.1.1.1
+++ acinclude.m4 24 Sep 2004 10:32:23 -0000
@@ -278,7 +278,6 @@
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
PHP_SUBST(SHLIB_SUFFIX_NAME)
- SHLIB_SUFFIX_NAME=so
case $host_alias in
*hpux*[)]
SHLIB_SUFFIX_NAME=sl
@@ -286,6 +285,12 @@
*darwin*[)]
SHLIB_SUFFIX_NAME=dylib
;;
+ *cygwin*[)]
+ SHLIB_SUFFIX_NAME=dll.a
+ ;;
+ *[)]
+ SHLIB_SUFFIX_NAME=so
+ ;;
esac
])
@@ -733,7 +738,15 @@
dnl
AC_DEFUN([PHP_BUILD_SHARED],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp4.la
+ case $host_alias in
+ *cygwin*[)]
+ OVERALL_TARGET=cygphp4.dll
+ ;;
+ *[)]
+ OVERALL_TARGET=libphp4.la
+ ;;
+ esac
+
php_build_target=shared
php_c_pre=$shared_c_pre
@@ -750,7 +763,14 @@
dnl
AC_DEFUN([PHP_BUILD_STATIC],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp4.la
+ case $host_alias in
+ *cygwin*[)]
+ OVERALL_TARGET=cygphp4.dll
+ ;;
+ *[)]
+ OVERALL_TARGET=libphp4.la
+ ;;
+ esac
php_build_target=static
])
@@ -1160,9 +1180,23 @@
dnl
AC_DEFUN([PHP_SHARED_MODULE],[
install_modules="install-modules"
- PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
- PHP_SUBST($2)
- cat >>Makefile.objects<<EOF
+ case $host_alias in
+ *cygwin*[)]
+ PHP_MODULES="$PHP_MODULES \$(phplibdir)/php4_$1.dll"
+ PHP_SUBST($2)
+ cat >>Makefile.objects<<EOF
+\$(phplibdir)/php4_$1.dll: $3/php4_$1.dll
+ \$(LIBTOOL) --mode=install cp $3/php4_$1.dll \$(phplibdir)
+
+$3/php4_$1.dll: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) \$(phptempdir)/\$(OVERALL_TARGET)
+ ifelse($4,,[\$(CC)],[\$(CXX)]) -shared \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) -L\$(phptempdir) -lphp4 ; \\
+
+EOF
+ ;;
+ *[)]
+ PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
+ PHP_SUBST($2)
+ cat >>Makefile.objects<<EOF
\$(phplibdir)/$1.la: $3/$1.la
\$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)
@@ -1170,6 +1204,8 @@
\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
EOF
+ ;;
+ esac
])
dnl
Index: ext/gd/config.m4
===================================================================
RCS file: /var/lib/cvsroot/php4/ext/gd/config.m4,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.m4
--- ext/gd/config.m4 24 Sep 2004 09:58:27 -0000 1.1.1.1
+++ ext/gd/config.m4 24 Sep 2004 10:27:05 -0000
@@ -111,6 +111,7 @@
if test "$PHP_XPM_DIR" != "no"; then
for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
+ test -f $i/lib/noX/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/noX/libXpm.a && GD_XPM_DIR=$i && GD_XPM_NOX=1 && break
test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i && break
done
@@ -119,23 +120,36 @@
fi
for i in include include/X11; do
- test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include
+ test -n "$GD_XPM_NOX" -a -f $GD_XPM_DIR/$i/noX/xpm.h && GD_XPM_INC=$GD_XPM_DIR/$i/noX
+ test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/$i
done
if test -z "$GD_XPM_INC"; then
AC_MSG_ERROR([xpm.h not found.])
fi
- PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
- [
- PHP_ADD_INCLUDE($GD_XPM_INC)
- PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
- ],[
- -L$GD_XPM_DIR/lib -lX11
- ])
+ if test -n "$GD_XPM_NOX"; then
+ PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
+ [
+ PHP_ADD_INCLUDE($GD_XPM_INC)
+ PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib/noX, GD_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
+ ],[
+ -L$GD_XPM_DIR/lib/noX
+ ])
+ else
+ PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
+ [
+ PHP_ADD_INCLUDE($GD_XPM_INC)
+ PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
+ ],[
+ -L$GD_XPM_DIR/lib -lX11
+ ])
+ fi
else
AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
fi
Index: sapi/apache/config.m4
===================================================================
RCS file: /var/lib/cvsroot/php4/sapi/apache/config.m4,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.m4
--- sapi/apache/config.m4 24 Sep 2004 09:58:38 -0000 1.1.1.1
+++ sapi/apache/config.m4 24 Sep 2004 12:43:18 -0000
@@ -61,6 +61,10 @@
SAPI_SHARED=libs/libphp4.so
build_type=bundle
;;
+ *cygwin*)
+ SAPI_SHARED=libs/cygphp4.dll
+ build_type=shared
+ ;;
*)
build_type=shared
;;