Custom installscript -- please?


#1

Custom installscript – please ?

To dreamhost : eAccelerator ? Can you at least tell us, in detail, how to install it ? – The “offical” and “detailed” installation guide – which is better than http://blog.robinz.info/archives/2006/02/15/how-to-install-eacceleartor-on-dreamhosts-host/

For the last week, on a daily basis, I’ve been attempting to install my customized version of Php5. I’ve seen a couple of installation scripts here and there … and nothing works perfectly or the installscripts I’ve seen don’t have the features that I want.

Would someone be kind of enough to post a working, functional, and detailed installscript – especially one that takes advantage of eAccelerator as well as the other optimizing modules ? – I must learn what I’m doing wrong. Mine doesn’t work… if yours does, then I can compare and contrast.

I need some kind of tutorial, something that goes into detail so that I can create my own installscript. I can’t learn about something by just copying and pasting some one else’s code.

I did find this : xampp-linux-1.5.1.tar.gz … and I’m tempted to upload it to my dreamhost account, extract it, and see what happens… however, they said that Xampp is not for production environments. [Sigh] It comes packed with goodies already … Now if I can use the features and modules found in xampp, without duplicating and clashing with what dreamhost already has installed … sweetness.

The wiki gives us an example of the modules to install … but doesn’t go into detail about how to add our own, nor does it go into detail about what it (the example installscript) installs when compared to what comes default. – In other words, does the wiki’s example installscript install all the features and provide the same usability as the default ?

Help me before I set my computer on fire.


#2

Well, this one works … kinda. I get get really far into the script, but for some reason it errors out with the final installation of the libxslt … something about undefined variables, if I remember correctly. Will post back with more detail.

#!/bin/bash

Abort on any errors

set -e

The domain in which to install the PHP CGI script.

export DOMAIN="****"

Where do you want all this stuff built? I’d recommend picking a local

filesystem.

Don’t pick a directory that already exists! We clean up after

ourselves at the end!

SRCDIR=${HOME}/source

And where should it be installed?

INSTALLDIR=${HOME}/php

Set DISTDIR to somewhere persistent, if you plan to muck around with this

script and run it several times!

DISTDIR=${HOME}/dist

Update version information here.

php="php-5.1.2"
LIBICONV="libiconv-1.10"
LIBMCRYPT="libmcrypt-2.5.7"
LIBXML2=“libxml2-2.6.23”

LIBXSLT=“libxslt-1.1.15”

MHASH="mhash-0.9.6"
ZLIB="zlib-1.2.3"
CURL="curl-7.15.3"
LIBIDN="libidn-0.6.3"
CCLIENT="c-client"
CCLIENT_DIR=“imap-2004g” # Another pest!

begin my custom file versions for download

M4="m4-1.4.4"
LIBTOOL="libtool-1.5.22"
AUTOCONF="autoconf-2.59"
AUTOMAKE="automake-1.9.6"
ASPELL=“aspell-0.60.4”

end my custom file versions for download

What PHP features do you want enabled?

PHPFEATURES="–prefix=${INSTALLDIR}
–with-config-file-path=${INSTALLDIR}/etc/php/${DOMAIN}
–enable-trans-sid
–with-xsl
–with-ttf=/usr
–with-freetype-dir=/usr
–enable-exif
–enable-fastcgi
–enable-force-cgi-redirect
–with-xml
–with-libxml-dir=${INSTALLDIR}
–enable-soap
–with-openssl=/usr
–with-mhash=${INSTALLDIR}
–with-mcrypt=${INSTALLDIR}
–with-zlib-dir=${INSTALLDIR}
–with-jpeg-dir=/usr
–with-png-dir=/usr
–with-gd
–enable-gd-native-ttf
–enable-ftp
–with-exif
–enable-sockets
–enable-wddx
–with-iconv=${INSTALLDIR}
–enable-sqlite-utf8
–enable-calendar
–with-curl=${INSTALLDIR}
–enable-mbstring
–enable-mbregex
–with-mysqli
–without-pear
–with-gettext
–with-imap=${INSTALLDIR}
–with-imap-ssl=/usr
#beginmycustomphpfeatures
–with-aspell=${ASPELL}"
#endmycustomphpfeatures

---- end of user-editable bits. Hopefully! ----

Push the install dir’s bin directory into the path

export PATH=${INSTALLDIR}/bin:$PATH

#setup directories
mkdir -p ${SRCDIR}
mkdir -p ${INSTALLDIR}
mkdir -p ${DISTDIR}
cd ${DISTDIR}

Get all the required packages

wget -c http://us2.php.net/distributions/${php}.tar.gz
wget -c http://ftp.gnu.org/pub/gnu/libiconv/${LIBICONV}.tar.gz
wget -c http://easynews.dl.sourceforge.net/sourceforge/mcrypt/${LIBMCRYPT}.tar.gz
wget -c http://ftp.acc.umu.se/pub/GNOME/sources/libxml2/2.6/${LIBXML2}.tar.gz

wget -c http://ftp.acc.umu.se/pub/GNOME/sources/libxslt/1.1/${LIBXSLT}.tar.gz

wget -c http://easynews.dl.sourceforge.net/sourceforge/mhash/${MHASH}.tar.gz
wget -c http://www.zlib.net/${ZLIB}.tar.gz
wget -c http://curl.haxx.se/download/${CURL}.tar.gz
wget -c ftp://alpha.gnu.org/pub/gnu/libidn/${LIBIDN}.tar.gz
wget -c ftp://ftp.cac.washington.edu/imap/${CCLIENT}.tar.Z

begin my custom installation

wget -c http://ftp.gnu.org/gnu/m4/${M4}.tar.gz
wget -c http://ftp.gnu.org/gnu/libtool/${LIBTOOL}.tar.gz
wget -c http://ftp.gnu.org/gnu/autoconf/${AUTOCONF}.tar.gz
wget -c http://ftp.gnu.org/gnu/automake/${AUTOMAKE}.tar.gz
wget -c ftp://ftp.gnu.org/gnu/aspell/${ASPELL}.tar.gz

end my custom installation

cd ${SRCDIR}

Unpack them all

tar xzf ${DISTDIR}/${php}.tar.gz
tar xzf ${DISTDIR}/${LIBICONV}.tar.gz
tar xzf ${DISTDIR}/${LIBMCRYPT}.tar.gz
tar xzf ${DISTDIR}/${LIBXML2}.tar.gz

tar xzf ${DISTDIR}/${LIBXSLT}.tar.gz

tar xzf ${DISTDIR}/${MHASH}.tar.gz
tar xzf ${DISTDIR}/${ZLIB}.tar.gz
tar xzf ${DISTDIR}/${CURL}.tar.gz
tar xzf ${DISTDIR}/${LIBIDN}.tar.gz
uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar x

begin to uncompress my custom downloads

tar xzf ${DISTDIR}/${M4}.tar.gz
tar xzf ${DISTDIR}/${LIBTOOL}.tar.gz
tar xzf ${DISTDIR}/${AUTOCONF}.tar.gz
tar xzf ${DISTDIR}/${AUTOMAKE}.tar.gz
tar xzf ${DISTDIR}/${ASPELL}.tar.gz

end of uncompressing my custom downloads

Build them in the required order to satisfy dependencies.

Note : ASPELL is installed after PHP.

begin custom installation

#m4
cd ${SRCDIR}/${M4}
sh ./configure --prefix=${INSTALLDIR}
make
make install

#libtool
cd ${SRCDIR}/${LIBTOOL}
sh ./configure --prefix=${INSTALLDIR}
make
make install

#autoconf
cd ${SRCDIR}/${AUTOCONF}
sh ./configure --prefix=${INSTALLDIR}
make
make install

#automake
cd ${SRCDIR}/${AUTOMAKE}
sh ./configure --prefix=${INSTALLDIR}
make
make install

end custom installation

#libiconv
cd ${SRCDIR}/${LIBICONV}
sh ./configure --enable-extra-encodings --prefix=${INSTALLDIR}

make clean

make
make install

#libxml2
cd ${SRCDIR}/${LIBXML2}
sh ./configure --with-iconv=${INSTALLDIR} --prefix=${INSTALLDIR}

make clean

make
make install

#libxslt
#cd ${SRCDIR}/${LIBXSLT}
#sh ./configure --prefix=${INSTALLDIR} \

–with-libxml-prefix=${INSTALLDIR} \

–with-libxml-include-prefix=${INSTALLDIR}/include/ \

–with-libxml-libs-prefix=${INSTALLDIR}/lib/

make clean

#make
#make install

#zlib
cd ${SRCDIR}/${ZLIB}
sh ./configure --shared --prefix=${INSTALLDIR}

make clean

make
make install

#libmcrypt
cd ${SRCDIR}/${LIBMCRYPT}
sh ./configure --disable-posix-threads --prefix=${INSTALLDIR}

make clean

make
make install

#libmcrypt lltdl issue!!
cd ${SRCDIR}/${LIBMCRYPT}/libltdl
sh ./configure --prefix=${INSTALLDIR} --enable-ltdl-install
make
make install

#mhash
cd ${SRCDIR}/${MHASH}
sh ./configure --prefix=${INSTALLDIR}

make clean

make
make install

#libidn
cd ${SRCDIR}/${LIBIDN}
sh ./configure --with-iconv-prefix=${INSTALLDIR} --prefix=${INSTALLDIR}

make clean

make
make install

#cURL
cd ${SRCDIR}/${CURL}
sh ./configure --with-ssl=${INSTALLDIR} --with-zlib=${INSTALLDIR}
–with-libidn=${INSTALLDIR} --enable-ipv6 --enable-cookies
–enable-crypto-auth --prefix=${INSTALLDIR}

make clean

make
make install

c-client

cd ${SRCDIR}/${CCLIENT_DIR}
make ldb

Install targets are for wusses!

cp c-client/c-client.a ${INSTALLDIR}/lib/libc-client.a
cp c-client/*.h ${INSTALLDIR}/include

#PHP 5
cd ${SRCDIR}/${php}
sh ./configure ${PHPFEATURES}

make clean

make
make install

begin custom installation

#aspell
cd ${SRCDIR}/${ASPELL}
sh ./configure && make
make install

end custom installation

#copy config file
mkdir -p ${INSTALLDIR}/etc/php/${DOMAIN};
cp ${SRCDIR}/${php}/php.ini-dist ${INSTALLDIR}/etc/php/${DOMAIN}/php.ini

#copy PHP CGI
mkdir -p ${HOME}/${DOMAIN}/cgi-bin
chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php.cgi
echo ---------- INSTALL COMPLETE! ----------


#3

I even commented out everything to do with libxslt … and I still get the error. But maybe that’s because I didn’t deleted everything first. In other words, I got the error after installing after a failed install without first deleting files and directories.


#4

hi,
Not to sure how things work here on DH as I only signed up a week or so ago and am still finding my way around. I did see a brief explanation about setting up your own compile of PHP but note you mention xAmpp which I have played with quite a lot albeit on Windoze.

After you recompile PHP you’ll need to restart Apache (I expect you know this) but I don’t know how you do this on DH but deleting the files and dirs will simply result in the script downloading all the libraries again, simpler to simply del the libxslt??


#5

I’ve got an Unofficial dreamhost support thread going on my forum. pennyquick.com.