diff -ruN ../httpd-2.0.52/support/suexec.c ./support/suexec.c
--- ../httpd-2.0.52/support/suexec.c	2004-08-23 11:07:18.000000000 -0400
+++ ./support/suexec.c	2005-01-09 19:25:23.000000000 -0500
@@ -90,6 +90,8 @@
 extern char **environ;
 static FILE *log = NULL;
 
+char *newargv[2];
+
 char *safe_env_lst[] =
 {
     /* variable name starts with */
@@ -227,9 +229,39 @@
     environ = cleanenv;
 }
 
+int phpcheck(char *prog)
+{
+	char *ext;
+	// Default argv for normal cgi
+	newargv[0]=prog;
+	newargv[1]=NULL;
+
+	if ((ext = strrchr(prog,'.')) == NULL)
+	{
+		return -1;
+	}
+	else if (!strncmp(ext, ".php", 4) || !strncmp(ext, ".phtml", 6))
+	{
+		newargv[0]=PHP5;
+		newargv[1]=prog;
+	}
+	else if (!strncmp(ext, ".php4",5))
+	{
+		newargv[0]=PHP4;
+		newargv[1]=prog;
+	}
+	else if (!strncmp(ext, ".php3",5))
+	{
+		newargv[0]=PHP3;
+		newargv[1]=prog;
+	}
+	return 1;
+}
+
 int main(int argc, char *argv[])
 {
     int userdir = 0;        /* ~userdir flag             */
+    int phpver;             /* version of php used       */
     uid_t uid;              /* user information          */
     gid_t gid;              /* target group placeholder  */
     char *target_uname;     /* target user name          */
@@ -560,8 +592,10 @@
      * Error out if the program is not executable for the user.
      * Otherwise, she won't find any error in the logs except for
      * "[error] Premature end of script headers: ..."
+     * If this is a php script, don't check the executability.
      */
-    if (!(prg_info.st_mode & S_IXUSR)) {
+    phpver=phpcheck(argv[3]);
+    if ((phpver == -1) && !(prg_info.st_mode & S_IXUSR)) {
         log_err("file has no execute permission: (%s/%s)\n", cwd, cmd);
         exit(121);
     }
@@ -599,10 +633,12 @@
     {
         extern char **environ;
 
-        ap_execve(cmd, &argv[3], environ);
+//        ap_execve(cmd, &argv[3], environ);
+        execve(newargv[0], &newargv[1], environ);
     }
 #else /*NEED_HASHBANG_EMUL*/
-    execv(cmd, &argv[3]);
+//    execv(cmd, &argv[3]);
+    execve(newargv[0], &newargv[1], environ);
 #endif /*NEED_HASHBANG_EMUL*/
 
     /*
diff -ruN ../httpd-2.0.52/support/suexec.h ./support/suexec.h
--- ../httpd-2.0.52/support/suexec.h	2004-02-09 15:59:49.000000000 -0500
+++ ./support/suexec.h	2005-01-09 19:10:40.000000000 -0500
@@ -104,4 +104,12 @@
 #define AP_SAFE_PATH "/usr/local/bin:/usr/bin:/bin"
 #endif
 
+/*
+ * Setuid PHP -- This will be used to execute php scripts using the php
+ *             binaries in /usr/local/bin
+ */
+#define PHP3 "/usr/local/bin/php3"
+#define PHP4 "/usr/local/bin/php4"
+#define PHP5 "/usr/local/bin/php5"
+
 #endif /* _SUEXEC_H */
