[Webapps-common-discuss] webapps-common/doc Webapps-Policy-Manual-DRAFT.txt,1.11,1.12

neilm@haydn.debian.org neilm@haydn.debian.org


Update of /cvsroot/webapps-common/webapps-common/doc
In directory haydn:/tmp/cvs-serv26580

Modified Files:
	Webapps-Policy-Manual-DRAFT.txt 
Log Message:
Added a bit of info about registering PHP modules

Index: Webapps-Policy-Manual-DRAFT.txt
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/doc/Webapps-Policy-Manual-DRAFT.txt,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Webapps-Policy-Manual-DRAFT.txt	9 May 2005 13:05:37 -0000	1.11
+++ Webapps-Policy-Manual-DRAFT.txt	9 May 2005 13:35:29 -0000	1.12
@@ -56,10 +56,10 @@
 
   3 Libraries for the web applications
     3.1 PHP libraries issues
-      3.1.1 Registering a php library with the webserver
-      3.1.1 Unregistering a php library with the webserver
-      3.1.2 PHP libraries security issues
-    3.2 Perl modules
+    3.2 PHP modules
+      3.2.1 PHP module locations
+      3.2.2 Registering and unregistering a php module
+    3.3 Perl modules
     
   4 Dealing with the webserver
     4.1 Registering a web application with the server
@@ -258,11 +258,72 @@
 
 3.1 PHP libraries issues
 
-3.1.1 Registering a php library with the webserver
+FIXME: Should also discuss "PHP libraries security issues".
 
-3.1.1 Unregistering a php library with the webserver
+3.2 PHP modules
+
+3.2.1 PHP module locations
+
+Modules for PHP must be located in the following folder:
+/usr/lib/phpVERSION/PHP_API_VERSION
+
+FIXME: Work out VERSION somehow.
+FIXME: Try and work out a less nasty way of getting the PHP_API_VERSION
+
+PHP_API_VERSION can be found with the following command:
+grep '\#define PHP_API_VERSION ' /usr/include/php4/main/php.h |sed 's/\#define PHP_API_VERSION //'
+
+3.2.2 Registering and unregistering a php module
+
+An entry should be placed in the relevent php.ini using postinst, if this is OK by the admin.
+--- SAMPLE CODE ---
+for pkg in apache cli cgi; do
+    if [ -f /etc/php4/$pkg/php.ini ]; then
+        if ! grep -q "^[[:space:]]*extension[[:space:]]*=[[:space:]]*clam.so" /etc/php4/$pkg/php.ini; then
+            echo "You are installing ClamAV support for php4, but it's not"
+            echo "enabled in your /etc/php4/$pkg/php.ini."
+            echo
+            echo "To enable it you need to add this line:"
+            echo
+            echo "extension=clam.so"
+            echo
+            echo -n "Do you want me to add it now [Y/n] ?"
+            read a
+            if ! echo $a | grep -iq ^n; then
+                echo "extension=clam.so" >> /etc/php4/$pkg/php.ini
+            fi
+            fi
+    fi
+done
+--- SAMPLE CODE ---
+
+Upon removal, the relevent entry in php.ini should be removed by prerm, if OK-ed by the admin
+--- SAMPLE CODE ---
+for pkg in apache cli cgi; do
+    if [ -f /etc/php4/$pkg/php.ini ]; then
+        if grep -q "^[[:space:]]*extension[[:space:]]*=[[:space:]]*clam.so" /etc/php4/$pkg/php.ini; then
+            echo "You are removing ClamAV support for php4, but it is still"
+            echo "enabled in your /etc/php4/$pkg/php.ini."
+            echo
+            echo "You should remove this line:"
+            echo
+            echo "extension=clam.so"
+            echo
+            echo -n "Do you want me to do it now [Y/n] ?"
+            read a
+            if ! echo $a | grep -iq ^n; then
+                cat /etc/php4/$pkg/php.ini | \
+                    grep -v "^[[:space:]]*extension[[:space:]]*=[[:space:]]*clam.so" \
+                    > /etc/php4/$pkg/php.ini.clamremove
+                mv /etc/php4/$pkg/php.ini.clamremove /etc/php4/$pkg/php.ini
+            fi
+        fi
+    fi
+done
+--- SAMPLE CODE ---
+
+FIXME: Should this lot be handled by debconf?
 
-3.1.2 PHP libraries security issues
 
 3.2 Perl modules