diff -r -u suphp-0.5.2-orig/src/apache2/mod_suphp.c suphp-0.5.2-php345/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-php345/src/apache2/mod_suphp.c	2005-02-11 15:03:20.000000000 +0100
@@ -33,6 +33,9 @@
 #include "util_script.h"
 #include "util_filter.h"
 
+#define PHP3TYPE "application/x-httpd-php3"
+#define PHP4TYPE "application/x-httpd-php4"
+#define PHP5TYPE "application/x-httpd-php5"
 
 module AP_MODULE_DECLARE_DATA suphp_module;
 
@@ -321,19 +324,35 @@
     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"))
-        return DECLINED;
-        
+    if (!strcmp(r->handler, PHP3TYPE)) {
+        /* this is a php3 request */
+        phpversion = 3;
+    } else {
+        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 DECLINED;
+            }
+        }
+    }
+
+
     /* check if suPHP is enabled for this request */
     
     if (((sconf->engine != SUPHP_ENGINE_ON)
@@ -404,7 +423,23 @@
     {
         apr_table_setn(r->subprocess_env, "PHP_CONFIG", apr_pstrdup(p, dconf->php_config));
     }
-    
+
+    /* add php version to env */
+
+    if (phpversion) {
+        if (phpversion == 3) {
+            apr_table_setn(r->subprocess_env, "PHP_VERSION", "PHP3");
+        } else {
+            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)
     {
         const char *auth = NULL;
diff -r -u suphp-0.5.2-orig/src/suphp.c suphp-0.5.2-php345/src/suphp.c
--- suphp-0.5.2-orig/src/suphp.c	2004-07-13 11:43:41.000000000 +0200
+++ suphp-0.5.2-php345/src/suphp.c	2005-02-11 15:03:06.000000000 +0100
@@ -36,8 +36,11 @@
 {
  char *php_config;
  char *env;
- char *const argv[] = { OPT_PATH_TO_PHP, NULL };
+ char *const argv3[] = { OPT_PATH_TO_PHP3, NULL };
+ char *const argv4[] = { OPT_PATH_TO_PHP4, NULL };
+ char *const argv5[] = { OPT_PATH_TO_PHP5, NULL };
  char *const *envp;
+ char *phpversion;
  
  // Set the enviroment (for compatibility reasons)
 
@@ -71,12 +74,26 @@
  suphp_unsetenv("PHP_SU_USER");
  suphp_unsetenv("PHP_SU_GROUP");
 #endif
+
+ if ((phpversion = getenv("PHP_VERSION")) == NULL)
+  error_msg_exit(ERRCODE_WRONG_ENVIRONMENT, "PHP_VERSION is not set", __FILE__, __LINE__);
  
  envp = suphp_copyenv((const char **) environ);
 
- // Exec PHP
- execve(OPT_PATH_TO_PHP, argv, envp);
- 
+ if (strcmp(phpversion, "PHP3") == 0) {
+  execve(OPT_PATH_TO_PHP3, argv3, envp);
+ } else {
+  if (strcmp(phpversion, "PHP4") == 0) {
+   execve(OPT_PATH_TO_PHP4, argv4, envp);
+  } else {
+   if (strcmp(phpversion, "PHP5") == 0) {
+    execve(OPT_PATH_TO_PHP5, argv5, 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-php345/src/suphp.h
--- suphp-0.5.2-orig/src/suphp.h	2004-07-13 11:43:41.000000000 +0200
+++ suphp-0.5.2-php345/src/suphp.h	2005-02-11 15:03:07.000000000 +0100
@@ -42,8 +42,16 @@
 #define OPT_APACHE_USER "wwwrun"
 #endif
 
-#ifndef OPT_PATH_TO_PHP
-#define OPT_PATH_TO_PHP "/usr/bin/php"
+#ifndef OPT_PATH_TO_PHP3
+#define OPT_PATH_TO_PHP3 "/usr/local/php3/bin/php"
+#endif
+
+#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
