If you provide ISP services for customers that run PHP application on your servers, you might need to run several sides with PHP 5.2 and not with the distributed version from Ubuntu, version 5.3. Searching around the internet, you might find several information on how to install a separate instance. For me, none of the howtos really were suitable. So this little document might help you in installing a cgi version. Here we go…
First of all, you need to install several packages from the Ubuntu repository.
We build a static PHP version, not using extensions.
apache2-prefork-dev \
autoconf \
automake \
bison chrpath \
debhelper \
flex \
freetds-dev \
hardening-wrapper \
libapr1-dev \
libbz2-dev \
libcurl4-openssl-dev \
libdb4.8-dev \
libenchant-dev \
libexpat1-dev \
libfreetype6-dev \
libgcrypt11-dev \
libgd2-xpm-dev \
libglib2.0-dev \
libgmp3-dev \
libicu-dev \
libjpeg-dev \
libkrb5-dev \
libldap2-dev \
libmhash-dev \
libmysqlclient-dev \
libpam0g-dev \
libpcre3-dev \
libpng12-dev \
libpq-dev \
libpspell-dev \
librecode-dev \
libsasl2-dev \
libsnmp-dev \
libsqlite0-dev \
libsqlite3-dev \
libssl-dev \
libt1-dev \
libtidy-dev \
libtool \
libwrap0-dev \
libxmltok1-dev \
libxml2-dev \
libxslt1-dev \
netbase \
quilt \
re2c \
unixodbc-dev \
zlib1g-dev \
libedit-dev \
tzdata \
libreadline-dev
These packages are only needed to build anything. Even I did not test it, I am pretty sure, you safely can remove all packages at the end of this how to.
Next get the source code form www.php.net. It it the old stable 5.2.17 as of writing this document.
unpack the code under /usr/local/src or anywhere else (as you prefer).
Change into the directory and issue the following command:
--prefix=/opt/php5.2 \
--enable-force-cgi-redirect \
--enable-fastcgi \
--with-config-file-path=/opt/php5.2 \
--with-config-file-scan-dir=/opt/php5.2/etc/conf.d \
--without-mm \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-mysql \
--with-mysqli \
--with-pgsql \
--with-sqlite \
--enable-sqlite-utf8 \
--sysconfdir=/opt/php5.2/etc \
--disable-debug \
--with-regex=php \
--disable-rpath \
--disable-static \
--with-pic \
--enable-pcntl \
--with-readline \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-freetype-dir \
--with-ldap \
--with-pspell \
--with-mcrypt \
--with-imap \
--with-imap-ssl \
--with-xsl \
--with-layout=GNU \
--enable-calendar \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-bcmath \
--with-bz2 \
--enable-ctype \
--with-db4 \
--without-gdbm \
--with-iconv \
--enable-exif \
--enable-ftp \
--with-gettext \
--enable-mbstring \
--with-pcre-regex \
--enable-shmop \
--enable-sockets \
--enable-wddx \
--with-libxml-dir \
--with-zlib \
--with-kerberos \
--with-openssl \
--enable-soap \
--enable-zip \
--with-mhash=yes
Next do a “make” followed by “make install”. I skipped “make test”. If you feel better, try it
Of course you might wish different features or even use a modular version of PHP. This is just the way, I created a PHP version to suite my needs.
Now you should find the result under /opt/php5.2. In your FastCGI-wrapper, you can specify
End of this little how to. Enjoy!
-- Download Compiling PHP 5.2 on Ubuntu Lucid 10.04 als PDF --
Deutsch
Recent Comments