diff -r -u suphp-0.5.2-orig/src/apache2/mod_suphp.c suphp-0.5.2-sander/src/apache2/mod_suphp.c
--- suphp-0.5.2-orig/src/apache2/mod_suphp.c	2004-07-13 11:43:41.000000000 +0200
+++ suphp-0.5.2-sander/src/apache2/mod_suphp.c	2005-02-11 09:46:26.000000000 +0100
@@ -33,6 +33,8 @@
 #include "util_script.h"
 #include "util_filter.h"
 
+#define PHP4TYPE "application/x-httpd-php4"
+#define PHP5TYPE "application/x-httpd-php5"
 
 module AP_MODULE_DECLARE_DATA suphp_module;
 
@@ -321,19 +323,34 @@
     apr_bucket_brigade *bb;
     apr_bucket *b;
     
+    int phpversion;
+
     /* load configuration */
     
     p = r->main ? r->main->pool : r->pool;
     sconf = ap_get_module_config(r->server->module_config, &suphp_module);
     dconf = ap_get_module_config(r->per_dir_config, &suphp_module);
     core_conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module);
-    
+
     /* only handle request if x-httpd-php handler is asigned */
-    
-    if (strcmp(r->handler, "x-httpd-php") 
-        && strcmp(r->handler, "application/x-httpd-php"))
+
+    if ( (strcmp(r->handler, PHP4TYPE) && strcmp(r->handler, PHP4TYPE)) && (strcmp(r->handler, PHP5TYPE) && strcmp(r->handler, PHP5TYPE)) )
         return DECLINED;
-        
+
+        if (!strcmp(r->handler, PHP4TYPE)) {
+                /* this is a php4 request */
+                phpversion = 4;
+        } else {
+            if (!strcmp(r->handler, PHP5TYPE)) {
+                /* this is a php5 request */
+                phpversion = 5;
+            } else {
+                /* this should not happen, error out */
+                return 500;
+            }
+        }
+
+
     /* check if suPHP is enabled for this request */
     
     if (((sconf->engine != SUPHP_ENGINE_ON)
@@ -404,6 +421,18 @@
     {
         apr_table_setn(r->subprocess_env, "PHP_CONFIG", apr_pstrdup(p, dconf->php_config));
     }
+
+    /* add php version to env */
+
+    if (phpversion) {
+        if (phpversion == 4) {
+            apr_table_setn(r->subprocess_env, "PHP_VERSION", "PHP4");
+        } else {
+            if (phpversion == 5) {
+                apr_table_setn(r->subprocess_env, "PHP_VERSION", "PHP5");
+            }
+        }
+    }
     
     if (r->headers_in)
     {
diff -r -u suphp-0.5.2-orig/src/suphp.c suphp-0.5.2-sander/src/suphp.c
--- suphp-0.5.2-orig/src/suphp.c	2004-07-13 11:43:41.000000000 +0200
+++ suphp-0.5.2-sander/src/suphp.c	2005-02-11 09:46:26.000000000 +0100
@@ -38,6 +38,7 @@
  char *env;
  char *const argv[] = { OPT_PATH_TO_PHP, NULL };
  char *const *envp;
+ char *phpversion;
  
  // Set the enviroment (for compatibility reasons)
 
@@ -71,12 +72,24 @@
  suphp_unsetenv("PHP_SU_USER");
  suphp_unsetenv("PHP_SU_GROUP");
 #endif
+
+ phpversion = getenv("PHP_VERSION");
  
  envp = suphp_copyenv((const char **) environ);
 
  // Exec PHP
- execve(OPT_PATH_TO_PHP, argv, envp);
- 
+ //execve(OPT_PATH_TO_PHP, argv, envp);
+
+ if (strcmp(phpversion, "PHP4") == 0) {
+  execve(OPT_PATH_TO_PHP4, argv, envp);
+ } else {
+  if (strcmp(phpversion, "PHP5") == 0) {
+   execve(OPT_PATH_TO_PHP5, argv, envp);
+  } else {
+   error_sysmsg_exit(ERRCODE_UNKNOWN, "No PHP version given!", __FILE__, __LINE__);
+  }
+ }
+
  // Should never be reached
  error_sysmsg_exit(ERRCODE_UNKNOWN, "execl() failed", __FILE__, __LINE__);
 }
diff -r -u suphp-0.5.2-orig/src/suphp.h suphp-0.5.2-sander/src/suphp.h
--- suphp-0.5.2-orig/src/suphp.h	2004-07-13 11:43:41.000000000 +0200
+++ suphp-0.5.2-sander/src/suphp.h	2005-02-11 09:46:26.000000000 +0100
@@ -42,8 +42,12 @@
 #define OPT_APACHE_USER "wwwrun"
 #endif
 
-#ifndef OPT_PATH_TO_PHP
-#define OPT_PATH_TO_PHP "/usr/bin/php"
+#ifndef OPT_PATH_TO_PHP4
+#define OPT_PATH_TO_PHP4 "/usr/local/php4/bin/php"
+#endif
+
+#ifndef OPT_PATH_TO_PHP5
+#define OPT_PATH_TO_PHP5 "/usr/local/php5/bin/php"
 #endif
 
 #ifndef OPT_LOGFILE
