Package: libapache2-mod-php5
Version: 5.2.4-1
Severity: wishlist

To make it easier for users to see that their LAMP installation is working,
PHP5 should provide a LAMP test page.

Please consider the attached diff for creating a /var/www/lamp-test/index.php
that tests PHP, MySQL and PostgreSQL.
diff -u php5-5.2.4/debian/libapache2-mod-php5.dirs php5-5.2.4/debian/libapache2-mod-php5.dirs
--- php5-5.2.4/debian/libapache2-mod-php5.dirs
+++ php5-5.2.4/debian/libapache2-mod-php5.dirs
@@ -3,0 +4 @@
+/var/www/lamp-test
diff -u php5-5.2.4/debian/changelog php5-5.2.4/debian/changelog
--- php5-5.2.4/debian/changelog
+++ php5-5.2.4/debian/changelog
@@ -1,3 +1,11 @@
+php5 (5.2.4-2) unstable; urgency=low
+
+  * added debian/lamp-test.php
+  * debian/libapache2-mod-php5.dirs: added /var/www/lamp-test
+  * debian/rules: install lamp-test.php to /var/www/lamp-test/index.php
+
+ -- Jamie Strandboge <[EMAIL PROTECTED]>  Tue, 23 Oct 2007 12:41:34 -0400
+
 php5 (5.2.4-1) unstable; urgency=low
 
   * New upstream release.
diff -u php5-5.2.4/debian/rules php5-5.2.4/debian/rules
--- php5-5.2.4/debian/rules
+++ php5-5.2.4/debian/rules
@@ -321,6 +321,8 @@
 		debian/libapache2-mod-php5/etc/apache2/mods-available/php5.load
 	cp debian/libapache2-mod-php5.conf \
 		debian/libapache2-mod-php5/etc/apache2/mods-available/php5.conf
+	cp debian/lamp-test.php \
+		debian/libapache2-mod-php5/var/www/lamp-test/index.php
 
 	# sanitize php.ini file
 	cat php.ini-dist | tr "\t" " " > debian/php5-common/usr/share/php5/php.ini-dist
only in patch2:
unchanged:
--- php5-5.2.4.orig/debian/lamp-test.php
+++ php5-5.2.4/debian/lamp-test.php
@@ -0,0 +1,107 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html> <head> <title>LAMP Server Test Page</title> </head> <body> <h2>LAMP Server Test Page</h2> <?php ini_set("display_errors", "Off"); $errors = array(); ?> <table CELLPADDING="0" CELLSPACING="0" WIDTH="50%"> <tr> <td><h3>Component</h3></td> <td><h3>Status</h3></td> <tr> <!-- If see this page in a browser, then Apache must be working --> <td>Apache</td><td>Works</td> </tr> <tr> <!-- 
+
+
+
+
+
+
+ ###################################################################################
+ #                                                                                 #
+ #    If you were prompted to download this page as lamp-test.php and/or           #
+ #    are viewing this as raw HTML in your browser, then php is not properly       #
+ #    installed.                                                                   #
+ #                                                                                 #
+ #    To install, do (as root):                                                    #
+ #    apt-get install libapache2-mod-php5                                          #
+ #    a2enmod php5                                                                 #
+ #    /etc/init.d/apache2 force-reload                                             #
+ #                                                                                 #
+ ###################################################################################
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
+
+ <td>PHP</td><td><!--
+<? /* > -->Not working<!-- Comment declaration
+
+*/  print("-"."-".">Works<!"."-"."-"); ?>--></td>
+</tr>
+
+<tr>
+ <td>Mysql (localhost)</td><td><!--
+  <?php /* -->Not working<!-- */
+	print("-"."->");
+	if (!extension_loaded("mysql")) {
+		array_push($errors, "Install php5-mysql, restart Apache and try again");
+		echo "Not Working<sup>", count($errors), "</sup>";
+	} else {
+		$conn = mysql_connect();
+		$errmsg = mysql_error();
+		$errno = mysql_errno();
+		// see http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html
+		if ($errno == 0 || $errno == 1045) {
+			echo "Works";
+		} else {
+			array_push($errors, $errmsg);
+			echo "Not Working<sup>", count($errors), "</sup>";
+		}
+	}
+	print("<!-"."-");
+?>
+-->
+ </td>
+</tr>
+<tr>
+ <td>PostgreSQL (localhost)</td>
+ <td><!--
+  <?php /* -->Not working<!-- */
+	print("-"."->");
+
+	// use register_shutdown_function, as a way to work around FATAL Undefined functions
+	if (!extension_loaded("pgsql")) {
+		array_push($errors, "Install php5-pgsql, restart Apache and try again");
+		echo "Not Working<sup>", count($errors), "</sup>";
+	} else {
+		$conn = pg_connect("hostaddr=127.0.0.1 user=www-data password=foobar");
+		$err = error_get_last();
+		if ($conn || ereg("password authentication failed", $err[message])) {
+			echo "Works";
+		} else {
+			array_push($errors, $err[message]);
+			echo "Not Working<sup>", count($errors), "</sup>";
+		}
+	}
+	print("<!-"."-");
+?>
+-->
+ </td>
+</tr>
+</table>
+<br>
+<font size="-1"><!-- 
+<?php 
+	print("-"."->");
+
+	$i = 1;
+	foreach($errors as $err) {
+		echo "[$i] $err<br>";
+		$i++;
+	}
+	print("<!-"."-");
+?> --> 
+</font>
+
+</body>
+</html>
+

Reply via email to