diff -uNr php-5.0.4.orig/configure.in php-5.0.4/configure.in
--- php-5.0.4.orig/configure.in	2005-03-30 23:43:12.000000000 +0200
+++ php-5.0.4/configure.in	2005-04-27 11:15:29.276399240 +0200
@@ -925,7 +925,7 @@
 fi
 
 PHP_ARG_WITH(pear, [whether to install PEAR],
-[  --with-pear=DIR         Install PEAR in DIR [PREFIX/lib/php]
+[  --with-pear=DIR         Install PEAR in DIR [PREFIX/lib/php5]
   --without-pear          Do not install PEAR], DEFAULT, yes)
 
 if test "$PHP_PEAR" != "no"; then
@@ -959,7 +959,7 @@
   if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
     case $PHP_LAYOUT in
       GNU) PEAR_INSTALLDIR=$datadir/pear;;
-      *)   PEAR_INSTALLDIR=$libdir/php;;
+      *)   PEAR_INSTALLDIR=$libdir/php5;;
     esac
   fi
 
@@ -1014,12 +1014,12 @@
 
 case $libdir in
   '${exec_prefix}/lib')
-    libdir=$libdir/php
+    libdir=$libdir/php5
     ;;
 esac
 case $datadir in
   '${prefix}/share')
-    datadir=$datadir/php
+    datadir=$datadir/php5
     ;;
   *) ;;
 esac
@@ -1076,7 +1076,7 @@
 EXPANDED_DATADIR=$datadir
 EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
 EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
+INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR:/usr/share/pear
 
 exec_prefix=$old_exec_prefix
 libdir=$old_libdir
diff -uNr php-5.0.4.orig/ext/ext_skel php-5.0.4/ext/ext_skel
--- php-5.0.4.orig/ext/ext_skel	2004-05-16 14:10:35.000000000 +0200
+++ php-5.0.4/ext/ext_skel	2005-04-27 11:14:32.914967480 +0200
@@ -70,7 +70,7 @@
 fi
 
 if test -z "$skel_dir"; then
-  skel_dir="skeleton"
+  skel_dir="/usr/lib/php5/skeleton"
 fi
 
 ## convert skel_dir to full path
diff -uNr php-5.0.4.orig/ext/session/session.c php-5.0.4/ext/session/session.c
--- php-5.0.4.orig/ext/session/session.c	2005-03-24 01:17:53.000000000 +0100
+++ php-5.0.4/ext/session/session.c	2005-04-27 11:14:32.923966112 +0200
@@ -152,11 +152,11 @@
 PHP_INI_BEGIN()
 	STD_PHP_INI_BOOLEAN("session.bug_compat_42",    "1",         PHP_INI_ALL, OnUpdateBool,   bug_compat,         php_ps_globals,    ps_globals)
 	STD_PHP_INI_BOOLEAN("session.bug_compat_warn",  "1",         PHP_INI_ALL, OnUpdateBool,   bug_compat_warn,    php_ps_globals,    ps_globals)
-	STD_PHP_INI_ENTRY("session.save_path",          "",          PHP_INI_ALL, OnUpdateSaveDir,save_path,          php_ps_globals,    ps_globals)
+	STD_PHP_INI_ENTRY("session.save_path",          "/var/lib/php5",      PHP_INI_ALL, OnUpdateString, save_path,          php_ps_globals,    ps_globals)
 	STD_PHP_INI_ENTRY("session.name",               "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name,       php_ps_globals,    ps_globals)
 	PHP_INI_ENTRY("session.save_handler",           "files",     PHP_INI_ALL, OnUpdateSaveHandler)
 	STD_PHP_INI_BOOLEAN("session.auto_start",       "0",         PHP_INI_ALL, OnUpdateBool,   auto_start,         php_ps_globals,    ps_globals)
-	STD_PHP_INI_ENTRY("session.gc_probability",     "1",         PHP_INI_ALL, OnUpdateLong,    gc_probability,     php_ps_globals,    ps_globals)
+	STD_PHP_INI_ENTRY("session.gc_probability",     "0",         PHP_INI_ALL, OnUpdateLong,    gc_probability,     php_ps_globals,    ps_globals)
 	STD_PHP_INI_ENTRY("session.gc_divisor",         "100",       PHP_INI_ALL, OnUpdateLong,    gc_divisor,        php_ps_globals,    ps_globals)
 	STD_PHP_INI_ENTRY("session.gc_maxlifetime",     "1440",      PHP_INI_ALL, OnUpdateLong,    gc_maxlifetime,     php_ps_globals,    ps_globals)
 	PHP_INI_ENTRY("session.serialize_handler",      "php",       PHP_INI_ALL, OnUpdateSerializer)
diff -uNr php-5.0.4.orig/php.ini-dist php-5.0.4/php.ini-dist
--- php-5.0.4.orig/php.ini-dist	2005-03-01 01:25:09.000000000 +0100
+++ php-5.0.4/php.ini-dist	2005-04-27 11:14:32.929965200 +0200
@@ -441,7 +441,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
+;include_path = ".:/usr/share/php"
 ;
 ; Windows: "\path1;\path2"
 ;include_path = ".;c:\php\includes"
@@ -458,7 +458,7 @@
 user_dir =
 
 ; Directory in which the loadable extensions (modules) reside.
-extension_dir = "./"
+; extension_dir = "./"
 
 ; Whether or not to enable the dl() function.  The dl() function does NOT work
 ; properly in multithreaded servers, such as IIS or Zeus, and is automatically
@@ -560,46 +560,10 @@
 ; extension_dir directive above.
 
 
-; Windows Extensions
-; Note that ODBC support is built in, so no dll is needed for it.
-; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
-; extension folders as well as the separate PECL DLL download (PHP 5).
-; Be sure to appropriately set the extension_dir directive.
-
-;extension=php_mbstring.dll
-;extension=php_bz2.dll
-;extension=php_curl.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd2.dll
-;extension=php_gettext.dll
-;extension=php_ifx.dll
-;extension=php_imap.dll
-;extension=php_interbase.dll
-;extension=php_ldap.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_mime_magic.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_msql.dll
-;extension=php_mysql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pgsql.dll
-;extension=php_shmop.dll
-;extension=php_snmp.dll
-;extension=php_sockets.dll
-;extension=php_sqlite.dll
-;extension=php_sybase_ct.dll
-;extension=php_tidy.dll
-;extension=php_xmlrpc.dll
-;extension=php_xsl.dll
+; Example lines:
 
+;extension=mysql.so
+;extension=gd.so
 
 ;;;;;;;;;;;;;;;;;;;
 ; Module Settings ;
@@ -878,7 +837,7 @@
 ;
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
-;session.save_path = "/tmp"
+;session.save_path = /var/lib/php5
 
 ; Whether to use cookies.
 session.use_cookies = 1
@@ -911,7 +870,10 @@
 ; e.g. 1/100 means there is a 1% chance that the GC process starts
 ; on each request.
 
-session.gc_probability = 1
+; This is disabled in the Debian packages, due to the strict permissions
+; on /var/lib/php5.  Instead of setting this here, see the cronjob at
+; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below
+;session.gc_probability = 0
 session.gc_divisor     = 100
 
 ; After this number of seconds, stored data will be seen as 'garbage' and
diff -uNr php-5.0.4.orig/php.ini-recommended php-5.0.4/php.ini-recommended
--- php-5.0.4.orig/php.ini-recommended	2005-03-01 01:25:09.000000000 +0100
+++ php-5.0.4/php.ini-recommended	2005-04-27 11:14:32.930965048 +0200
@@ -499,7 +499,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
+;include_path = ".:/usr/share/php"
 ;
 ; Windows: "\path1;\path2"
 ;include_path = ".;c:\php\includes"
@@ -516,7 +516,7 @@
 user_dir =
 
 ; Directory in which the loadable extensions (modules) reside.
-extension_dir = "./"
+;extension_dir = "./"
 
 ; Whether or not to enable the dl() function.  The dl() function does NOT work
 ; properly in multithreaded servers, such as IIS or Zeus, and is automatically
@@ -617,47 +617,10 @@
 ; needs to go here.  Specify the location of the extension with the
 ; extension_dir directive above.
 
+; Example lines:
 
-; Windows Extensions
-; Note that ODBC support is built in, so no dll is needed for it.
-; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
-; extension folders as well as the separate PECL DLL download (PHP 5).
-; Be sure to appropriately set the extension_dir directive.
-
-;extension=php_mbstring.dll
-;extension=php_bz2.dll
-;extension=php_curl.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd2.dll
-;extension=php_gettext.dll
-;extension=php_ifx.dll
-;extension=php_imap.dll
-;extension=php_interbase.dll
-;extension=php_ldap.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_mime_magic.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_msql.dll
-;extension=php_mysql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pgsql.dll
-;extension=php_shmop.dll
-;extension=php_snmp.dll
-;extension=php_sockets.dll
-;extension=php_sqlite.dll
-;extension=php_sybase_ct.dll
-;extension=php_tidy.dll
-;extension=php_xmlrpc.dll
-;extension=php_xsl.dll
-
+;extension=mysql.so
+;extension=gd.so
 
 ;;;;;;;;;;;;;;;;;;;
 ; Module Settings ;
@@ -936,7 +894,7 @@
 ;
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
-;session.save_path = "/tmp"
+;session.save_path = /var/lib/php5
 
 ; Whether to use cookies.
 session.use_cookies = 1
@@ -969,7 +927,10 @@
 ; e.g. 1/100 means there is a 1% chance that the GC process starts
 ; on each request.
 
-session.gc_probability = 1
+; This is disabled in the Debian packages, due to the strict permissions
+; on /var/lib/php5.  Instead of setting this here, see the cronjob at
+; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below
+;session.gc_probability = 0
 session.gc_divisor     = 1000
 
 ; After this number of seconds, stored data will be seen as 'garbage' and
diff -uNr php-5.0.4.orig/sapi/caudium/config.m4 php-5.0.4/sapi/caudium/config.m4
--- php-5.0.4.orig/sapi/caudium/config.m4	2004-01-17 14:00:10.000000000 +0100
+++ php-5.0.4/sapi/caudium/config.m4	2005-04-27 11:14:32.935964288 +0200
@@ -24,8 +24,8 @@
 		AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
 	fi
     if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
-		PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
-	    PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
+		PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Master file' | sed -e 's/.*: //' -e 's/master.pike/modules/'`
+	    PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/modules,,' -e 's,modules,include,' `
 		if test -z "$PIKE_INCLUDE_DIR" || test -z "$PIKE_MODULE_DIR"; then
 			AC_MSG_ERROR(Failed to figure out Pike module and include directories)
 		fi
@@ -82,7 +82,9 @@
     PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`   
 	AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
     PHP_SELECT_SAPI(caudium, shared, caudium.c)
-	INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP5.so"
+    dnl FIXME: This is the ugliest hack in the world!
+    dnl INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)$withval/lib/$PIKE_VERSION/ && \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$withval/lib/$PIKE_VERSION/php5.so"
+	INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)$withval/lib/$PIKE_VERSION/ && \$(INSTALL) -m 0755 .$SAPI_SHARED \$(INSTALL_ROOT)$withval/lib/$PIKE_VERSION/PHP5.so"
 	RESULT="	*** Pike binary used:         $PIKE
 	*** Pike include dir(s) used: $PIKE_INCLUDE_DIR
 	*** Pike version:             $PIKE_VERSION"
diff -uNr php-5.0.4.orig/sapi/cli/php.1.in php-5.0.4/sapi/cli/php.1.in
--- php-5.0.4.orig/sapi/cli/php.1.in	2004-05-02 11:14:02.000000000 +0200
+++ php-5.0.4/sapi/cli/php.1.in	2005-04-27 11:14:32.936964136 +0200
@@ -296,13 +296,17 @@
 .B name
 .SH FILES
 .TP 15
-.B php\-cli.ini
+.B /etc/php5/cli/php.ini
 The configuration file for the CLI version of PHP.
 .TP
-.B php.ini
-The standard configuration file will only be used when 
-.B php\-cli.ini
-cannot be found.
+.B /etc/php5/cgi/php.ini
+The configuration file for the CGI version of PHP.
+.TP
+.B /etc/php5/apache/php.ini
+The configuration file for the version of PHP that apache uses.
+.TP
+.B /etc/php5/apache2/php.ini
+The configuration file for the version of PHP that apache2 uses.
 .SH EXAMPLES
 .TP 5
 \fIphp -r 'echo "Hello World\\n";'\fP
diff -uNr php-5.0.4.orig/scripts/Makefile.frag php-5.0.4/scripts/Makefile.frag
--- php-5.0.4.orig/scripts/Makefile.frag	2005-02-28 06:28:25.000000000 +0100
+++ php-5.0.4/scripts/Makefile.frag	2005-04-27 11:14:32.936964136 +0200
@@ -3,8 +3,8 @@
 # Build environment install
 #
 
-phpincludedir = $(includedir)/php
-phpbuilddir = $(libdir)/build
+phpincludedir = $(includedir)/php5
+phpbuilddir = $(prefix)/lib/php5/build
 
 BUILD_FILES = \
 	scripts/phpize.m4 \
diff -uNr php-5.0.4.orig/scripts/php-config.in php-5.0.4/scripts/php-config.in
--- php-5.0.4.orig/scripts/php-config.in	2005-03-16 07:36:54.000000000 +0100
+++ php-5.0.4/scripts/php-config.in	2005-04-27 11:14:32.936964136 +0200
@@ -3,8 +3,8 @@
 exec_prefix="@exec_prefix@"
 version="@PHP_VERSION@"
 version_id="@PHP_VERSION_ID@"
-includedir="@includedir@/php"
+includedir="@includedir@/php5"
-includes="-I$includedir -I$includedir/main -I$includedir/TSRM -I$includedir/Zend -I$includedir/ext -I$includedir/ext/date/lib"
+includes="-I$includedir -I$includedir/main -I$includedir/TSRM -I$includedir/Zend -I$includedir/ext -I$includedir/ext/date/lib $(getconf LFS_CFLAGS)"
 ldflags="@PHP_LDFLAGS@"
 libs="@EXTRA_LIBS@"
 extension_dir='@EXTENSION_DIR@'
diff -uNr php-5.0.4.orig/scripts/phpize.in php-5.0.4/scripts/phpize.in
--- php-5.0.4.orig/scripts/phpize.in	2005-01-25 13:54:57.000000000 +0100
+++ php-5.0.4/scripts/phpize.in	2005-04-27 11:14:32.943963072 +0200
@@ -3,8 +3,8 @@
 # Variable declaration
 prefix='@prefix@'
 exec_prefix="`eval echo @exec_prefix@`"
-phpdir="`eval echo @libdir@`/build"
-includedir="`eval echo @includedir@`/php"
+phpdir="$prefix/lib/php5/build"
+includedir="$prefix/include/php5"
 builddir="`pwd`"
 
 FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
