Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 29th March 2011, 14:01
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 927
Thanks: 16
Thanked 261 Times in 208 Posts
Post ISPConfig on Debian 6 with optional PHP 5.2 for single webs

Updating a running debian 5 (lenny) server with client webs on it to debian 6 (squeeze) can lead to problems if some of the webs rely on functions that are deprecated or behave different in debian 6.

I just puglished a blog article in german language here:
http://www.soeren-hentzschel.at/tech..._phpmod_fcgid/

It shows how to add php 5.2.17 support to debian 6 with mod_fcgid using apache directives in ISPConfig 2.

Here is the complete shell script that does all the needed steps automatically.
(my original script is in german, so i translated the neccessary parts)

The script does:
- install neccessary packages via apt
- configure mod_fcgid in apache2
- create skeleton fcgi-starter dir
- create script to prepare webs
- download, compile and install php 5.2.17 (32 or 64 bit)

I cannot guarantee this will work for you as it does for me. Use it at your own risk!
Copy the content of the following code section to a shell file (e.g. deb_php52.sh) and run it.
After the script completes you will get a /root/fcgi-copy.sh file that you have to run once for each web you will enable PHP 5.2 for.
Code:
#!/bin/sh

if [[ $(id -u) -ne 0 ]] ; then
    echo "Please run this script with root privilegues!" ;
    exit 2 ;
fi

DEBIAN_OK=`cat /etc/debian_version`

if [[ "$DEBIAN_OK" = "" ]] ; then
  echo "This is not a debian server?!...";
  exit;
fi

read -p "We are going to install some debian packages now! Do you want to proceed (y/N)? " DOIT

if [[ "$DOIT" != "y" ]] ; then
    echo "Abgebrochen." ;
    exit 0 ;
fi

apt-get install -q -y libapache2-mod-fcgid apache2-suexec libpcre3-dev libpcre++-dev libpng12-dev libbz2-dev libcurl4-openssl-dev libc-client2007e-dev libjpeg-dev libgif-dev libgif4 libpthread-stubs0 libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxpm-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev libfreetype6-dev libxml2-dev

a2enmod fcgid
a2enmod suexec

cd /tmp
wget -q "http://de.php.net/get/php-5.2.17.tar.bz2/from/this/mirror" -O php.tar.bz2
tar xjf php.tar.bz2
cd php-5.2.17

CHECK=`grep "FcgidMaxRequestLen" /etc/apache2/mods-available/fcgid.conf`
if [[ "$CHECK" = "" ]] ; then
  CHECK=`grep "FcgidConnectTimeout" /etc/apache2/mods-available/fcgid.conf`
  if [[ "$CHECK" = "" ]] ; then
    echo "FcgidMaxRequestLen 1073741824" >> /etc/apache2/mods-available/fcgid.conf ;
  else
    sed -i -e "s/^\(\s*FcgidConnectTimeout.*\)$/\1\n  FcgidMaxRequestLen 1073741824/" /etc/apache2/mods-available/fcgid.conf ;
  fi
else
  sed -i -r "s/^\s*FcgidMaxRequestLen\s+\d+.*$/FcgidMaxRequestLen 1073741824/" /etc/apache2/mods-available/fcgid.conf ;
fi

/etc/init.d/apache2 stop
/etc/init.d/apache2 start

CHECK=`uname -a | grep 'amd64'`
if [[ "$CHECK" = "" ]] ; then
  echo "Compiling on 32Bit system" ;
  ./configure --prefix=/usr/share/php52 --datadir=/usr/share/php52 --mandir=/usr/share/man --bindir=/usr/bin/php52 --with-libdir=lib --includedir=/usr/include --sysconfdir=/etc/php52/apache2 --with-config-file-path=/etc/php52/apache2 --with-config-file-scan-dir=/etc/php52/conf.d --enable-libxml --enable-session --with-pcre-regex=/usr --enable-xml --enable-simplexml --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-shared --with-pic --with-gnu-ld --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --enable-exif --enable-fastcgi --enable-force-cgi-redirect --with-zlib --with-bz2 --with-curl --with-ldap --with-mysqli --with-ttf --with-freetype-dir --enable-soap --enable-sockets --enable-calendar --enable-ftp --enable-mbstring --enable-gd-native-ttf --enable-bcmath --enable-zip --with-pear --with-openssl --with-imap --with-imap-ssl --with-kerberos ;
else
  echo "Compiling on 64Bit system" ;
  ./configure --prefix=/usr/share/php52 --datadir=/usr/share/php52 --mandir=/usr/share/man --bindir=/usr/bin/php52 --with-libdir=lib64 --includedir=/usr/include --sysconfdir=/etc/php52/apache2 --with-config-file-path=/etc/php52/apache2 --with-config-file-scan-dir=/etc/php52/conf.d --enable-libxml --enable-session --with-pcre-regex=/usr --enable-xml --enable-simplexml --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-shared --with-pic --with-gnu-ld --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --enable-exif --enable-fastcgi --enable-force-cgi-redirect --with-zlib --with-bz2 --with-curl --with-ldap --with-mysqli --with-ttf --with-freetype-dir --enable-soap --enable-sockets --enable-calendar --enable-ftp --enable-mbstring --enable-gd-native-ttf --enable-bcmath --enable-zip --with-pear --with-openssl --with-imap --with-imap-ssl --with-kerberos ;
fi

make && make install

echo "Compiled and installed PHP. If errors occured here, please press CTRL-C to abort!"
read -p "Creating scripts now... press ENTER to proceed (CTRL+C to cancel)"

cp /etc/php5/apache2/php.ini /etc/php52/apache2/
mkdir /etc/php52/cgi
cp /etc/php5/apache2/php.ini /etc/php52/cgi/

mkdir -p /etc/php52/php-fcgi/

echo '#!/bin/sh

FCGID_STARTER_PHPBIN="/usr/bin/php52/php-cgi -c /etc/php52/cgi/"
    
exec $FCGID_STARTER_PHPBIN
' > /etc/php52/php-fcgi/php-starter

chmod 750 /etc/php52/php-fcgi/php-starter
chattr +i /etc/php52/php-fcgi/php-starter


echo '#!/bin/sh
WEB_USER=$1
WEB_ID=$2
 
if [ "$WEB_USER" = "" ] ; then
echo "$0 <WEB_USER> <WEB_ID>.";
echo "z. B. $0 web4_ftp_adm web4";
exit 1;
fi
 
if [ "$WEB_ID" = "" ] ; then
echo "$0 <WEB_USER> <WEB_ID>.";
echo "z. B. $0 web4_ftp_adm web4";
exit 1;
fi
 
if [ ! -e "/var/www/${WEB_ID}" ] ; then
echo "Directory /var/www/${WEB_ID} is missing."
exit 1;
fi
 
if [ ! -e "/etc/php52/php-fcgi" ] ; then
echo "Template directory /etc/php52/php-fcgi is missing."
exit 1;
fi
 
cp -a /etc/php52/php-fcgi /var/www/${WEB_ID}/
chown -R ${WEB_USER}:${WEB_ID} /var/www/${WEB_ID}/php-fcgi
chattr +i /var/www/${WEB_ID}/php-fcgi/php-starter
 
find /var/www/${WEB_ID}/web -user www-data -exec chown ${WEB_USER}:${WEB_ID} {} \;
 
echo "Please copy the following code section to the apache directives of ${WEB_ID}:"
echo "====================================="
echo "SuexecUserGroup ${WEB_USER} ${WEB_ID}"
echo "<FilesMatch \.php$>"
echo "    SetHandler fcgid-script"
echo "</FilesMatch>"
echo ""
echo "AddHandler fcgid-script .php .php4 .php5"
echo "FCGIWrapper \"/var/www/${WEB_ID}/php-fcgi/php-starter\" .php"
echo "FCGIWrapper \"/var/www/${WEB_ID}/php-fcgi/php-starter\" .php5"
echo "FCGIWrapper \"/var/www/${WEB_ID}/php-fcgi/php-starter\" .php4"
echo ""
echo "====================================="' > /root/fcgi-copy.sh

chmod 700 /root/fcgi-copy.sh

echo "ALL DONE!"
echo "Run the command /root/fcgi-copy.sh to prepare a web for PHP 5.2.17."

Last edited by Croydon; 10th May 2011 at 11:06.
Reply With Quote
The Following 4 Users Say Thank You to Croydon For This Useful Post:
counterpoint (6th September 2011), falko (30th March 2011), Qluripax (22nd August 2011), till (29th March 2011)
Sponsored Links
 

Bookmarks

Tags
debian, ispconfig 2, php 5.2, squeeze

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
coexistence of php4 and php5 on ISPC3 AceLine Tips/Tricks/Mods 5 5th November 2010 14:56
libWand.so.10 error Taxick Installation/Configuration 8 3rd May 2009 01:27
ISPConfig virtual web pages not working mike_phi Installation/Configuration 8 7th May 2008 16:51
php script injections Grizzly General 21 18th July 2006 08:55
e-mail problem!!! Debian 3.1 maroonworks Installation/Configuration 18 6th December 2005 14:42


All times are GMT +2. The time now is 06:21.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.