diff --git a/package/alessandro/php/config.hlp b/package/alessandro/php/config.hlp
index 4cbd30c63..08819579a 100644
--- a/package/alessandro/php/config.hlp
+++ b/package/alessandro/php/config.hlp
@@ -23,6 +23,10 @@
 MENU_PKG_PHP
   Here you will find all options concerning PHP.
 
+ROCKCFG_PKG_PHP_VERSION
+  Only one PHP package can be build, so choose here between
+  PHP4 or PHP5.
+
 ROCKCFG_PKG_PHP_FORCESHARED
   Please check here if you want to use shared libraries instead of
   PHP's built-in support for various applications.
diff --git a/package/alessandro/php/config.in b/package/alessandro/php/config.in
index d33e8e10e..9272e24a1 100644
--- a/package/alessandro/php/config.in
+++ b/package/alessandro/php/config.in
@@ -22,7 +22,22 @@
 
 if pkgcheck php X ; then
 	menu_begin MENU_PKG_PHP 'PHP Package Options'
-		bool 'Force usage of shared modules' ROCKCFG_PKG_PHP_FORCESHARED 0
+
+                k=' 4 Build_PHP4 5 Build_PHP5'
+                d=4
+                choice ROCKCFG_PKG_PHP_VERSION $d $k
+                
+                if [ $ROCKCFG_PKG_PHP_VERSION = 4 ] ; then
+                   pkgfork php php4
+                   pkgdisable php=php5
+                else
+                   pkgfork php php5
+                   pkgdisable php=php4 
+                fi
+
+                pkgremove php
+	
+        	bool 'Force usage of shared modules' ROCKCFG_PKG_PHP_FORCESHARED 0
 		for xpkg in postgresql openssl mysql libgd ; do
 		  if pkgcheck $xpkg X ; then
 		  	bool "Build PHP with $xpkg support" ROCKCFG_PKG_PHP_$xpkg 1
diff --git a/package/alessandro/php/php.conf b/package/alessandro/php/php.conf
index 9a7334a36..fafbb3ae2 100644
--- a/package/alessandro/php/php.conf
+++ b/package/alessandro/php/php.conf
@@ -20,6 +20,8 @@
 # 
 # --- ROCK-COPYRIGHT-NOTE-END ---
 
+patchfiles="`ls $confdir/$xpkg/*.patch 2>/dev/null | tr '\n' ' '`" $patchfiles
+
 var_append extraconfopt " " "--with-apxs2=$root/opt/apache/sbin/apxs"
 var_append extraconfopt " " "--with-zlib --with-bz2"
 
@@ -32,6 +34,9 @@ if [ "$ROCKCFG_PKG_PHP_mysql" == 1 ] ; then
 		pkg_php_shared=''
 	fi
 	var_append extraconfopt " " "--with-mysql$pkg_php_shared"
+        if [ "$xpkg" = "php5" ] ; then
+           var_append extraconfopt " " "--with-mysqli"
+        fi
 fi
 
 [ "$ROCKCFG_PKG_PHP_postgresql" == 1 ] && var_append extraconfopt " " "--with-pgsql=$root/${pkg_postgresql_prefix}"
diff --git a/package/alessandro/php/php.desc b/package/alessandro/php/php.desc
index 801c465e8..453d1c005 100644
--- a/package/alessandro/php/php.desc
+++ b/package/alessandro/php/php.desc
@@ -36,8 +36,15 @@
 
 [L] OpenSource
 [S] Stable
-[V] 4.3.10
 [P] X -?---5---9 149.500
 
-[D] 1523172590 php-4.3.10.tar.bz2 http://static.php.net/www.php.net/distributions/
+#if xpkg == php4
+[V] 4.4.0
+[D] 2998941714 php-4.4.0.tar.bz2 http://static.php.net/www.php.net/distributions/
+#endif
+
+#if xpkg == php5
+[V] 5.0.5
+[D] 130795334 php-5.0.5.tar.bz2 http://static.php.net/www.php.net/distributions/
+#endif
 
diff --git a/package/alessandro/php/apsx-fix.patch b/package/alessandro/php/php4/apsx-fix.patch
similarity index 100%
rename from package/alessandro/php/apsx-fix.patch
rename to package/alessandro/php/php4/apsx-fix.patch
diff --git a/package/alessandro/php/errno.patch b/package/alessandro/php/php4/errno.patch
similarity index 100%
rename from package/alessandro/php/errno.patch
rename to package/alessandro/php/php4/errno.patch
diff --git a/package/alessandro/php/php5/do-not-touch-httpd-conf.patch b/package/alessandro/php/php5/do-not-touch-httpd-conf.patch
new file mode 100644
index 000000000..f90b9632c
--- /dev/null
+++ b/package/alessandro/php/php5/do-not-touch-httpd-conf.patch
@@ -0,0 +1,57 @@
+# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
+# 
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+# Please add additional copyright information _after_ the line containing
+# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
+# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
+# 
+# ROCK Linux: rock-src/package/alessandro/php/php5/do-not-touch-httpd-conf.patch
+# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
+# 
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# 
+# --- ROCK-COPYRIGHT-NOTE-END ---
+
+--- php-5.0.5/configure.orig	2005-09-13 22:02:51.000000000 +0200
++++ php-5.0.5/configure	2005-09-13 22:00:52.000000000 +0200
+@@ -3672,7 +3672,7 @@
+                       \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+                        $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+                              -S SYSCONFDIR='$APXS_SYSCONFDIR' \
+-                             -i -a -n php5 $SAPI_SHARED"
++                             -i -n php5 $SAPI_SHARED"
+     fi
+   fi
+ 
+@@ -4776,7 +4776,7 @@
+                 \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+                  $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+                        -S SYSCONFDIR='$APXS_SYSCONFDIR' \
+-                       -i -a -n php5"
++                       -i -n php5"
+   fi
+ 
+   case $host_alias in
+@@ -5606,7 +5606,7 @@
+                 \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+                  $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+                        -S SYSCONFDIR='$APXS_SYSCONFDIR' \
+-                       -i -a -n php5"
++                       -i -n php5"
+   fi
+ 
+   case $host_alias in
+@@ -6618,7 +6618,7 @@
+                       \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+                        $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+                              -S SYSCONFDIR='$APXS_SYSCONFDIR' \
+-                             -i -a -n php5 $SAPI_SHARED"
++                             -i -n php5 $SAPI_SHARED"
+     fi
+   fi
+