Build PHP 5.2.6 CGI on Ubuntu Hardy

2008-06-28 by xpheas
Update the system and install required packages:
(This setup would install a full LAMP environment)
BASH-Code:
1
2
3
apt-get update
apt-get upgrade
apt-get install build-essential autoconf apache2 apache2-threaded-dev mysql-server libmysqlclient15-dev curl libcurl4-openssl-dev openssl flex libxml2-dev libpng12-0 libpng12-dev libjpeg62 libjpeg62-dev libfreetype6 libfreetype6-dev libmcrypt4 libmcrypt-dev libtool libbz2-dev libc-client2007 libc-client2007-dev

Download and unpack the PHP Sources
BASH-Code:
1
2
3
wget http://at2.php.net/distributions/php-5.2.6.tar.gz
tar xfvz php-5.2.6.tar.gz
cd php-5.2.6

Build PHP
BASH-Code:
1
2
3
4
5
6
7
8
9
10
11
./configure '--prefix=/usr/share/php5-cgi' '--datadir=/usr/share/php5-cgi' '--bindir=/usr/bin/php5-cgi' '--libdir=/usr/share/php5-cgi' \
'--with-exec-dir=/usr/lib/php5-cgi/bin' '--sysconfdir=/etc/php5-cgi' '--with-config-file-path=/etc/php5-cgi' '--with-config-file-scan-dir=/etc/php5-cgi' \
'--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-freetype-dir=/usr' '--with-gettext' '--with-mcrypt' '--with-mysql' \
'--with-mysqli' '--with-curl' '--with-curlwrappers' '--with-zlib' '--with-pear' '--with-openssl' '--with-mime-magic' '--with-bz2' \
'--with-imap' '--with-imap-ssl' '--with-kerberos' '--enable-libxml' '--enable-session' '--enable-xml' '--enable-simplexml' \
'--enable-inline-optimization' '--enable-zend-multibyte' '--enable-exif' '--enable-mbstring' '--enable-gd-jis-conv' '--enable-gd-native-ttf' \
'--enable-bcmath' '--enable-sockets' '--enable-ftp' '--enable-dba' '--enable-calendar' '--enable-shmop' '--enable-soap' '--enable-zip' \
'--enable-force-cgi-redirect' '--enable-fastcgi' '--disable-debug' '--disable-ipv6'
 
make
make install

Enable CGI on your vhost
BASH-Code:
1
2
3
4
5
6
7
8
9
10
ScriptAlias /php5-cgi /usr/bin/php5-cgi/php-cgi
<VirtualHost *>
  ...
  <Directory /var/www>
    Action php5-cgi /php5-cgi
    AddHandler php5-cgi .php
    Options +ExecCGI -Includes -Indexes
  </Directory>
  ...
</VirtualHost>

Enable required modules
BASH-Code:
1
2
a2enmod actions
a2enmod cgi

Finally restart your webserver
BASH-Code:
1
/etc/init.d/apache2 restart

  » comments (0)