Talk:PHP 5 install script

From DreamHost
Revision as of 08:32, 26 September 2007 by Mousee (Talk | contribs)

Jump to: navigation, search

Development Script

If you're interested in further developing this install script, please use the PHP_5_install_script/dev article to do so. This way it keeps the main article here cleaner in terms of edits/updates and hopefully will serve as a working grounds to better the overall quality and usability of this install script. I haven't yet worked out a time-line (or guideline) as to how and when commits from there should be made here, so any ideas or suggestions (preferably made in the development article's discussion page) would be awesome! Thanks. Mousee 10:35, 28 June 2007 (PDT)

Article Naming

Do NOT convert this into a template. That is a misuse of the wiki templating system. -- Scjessey 08:50, 19 Apr 2006 (PDT)


i have developed and tested this code for security reasons. but i'm still having trouble with the symbolic link created by the line: ln -s $HOME/php/bin/php $HOME/$DOMAIN/cgi-bin/php.cgi

if i run this, a 500 error occurs. in the error log is this line: [Sun Apr 9 08:48:55 2006] [error] [client 62.214.203.9] Premature end of script headers: /home/php5dev/dev1.jv24.org/cgi-bin/php.cgi

if i copy the hole php executable it works as expected... file permission is set.

anyone out there who can help me?

--B0ther 09:21, 9 Apr 2006 (PDT)

--- cut ---

# 
#---COPY ALL THIS---
# CHANGE THIS TO YOUR DOMAIN NAME:
export DOMAIN=YOUR.DOMAIN

# Change this to the PHP Version of your choice
export PHP5=php-5.1.2

# Change this to the last working Libs (may be you have to try and error)
export LIBICONF=libiconv-1.10
export LIBMCRYPT=libmcrypt-2.5.7
export LIBXML2=libxml2-2.6.23
export LIBXSLT=libxslt-1.1.15
export MHASH=mhash-0.9.6
export ZLIB=zlib-1.2.3
export CURL=curl-7.15.3
export LIBIDN=libidn-0.6.3
export IMAP=imap-2004g

# setup directories
# change to the right folder. always.
cd $HOME

# make folder for the executables
mkdir -p php

# make folder for the sources
mkdir -p src/php

# change to source folder
cd src/php

# get PHP
wget http://us3.php.net/distributions/$PHP5.tar.gz

# extract php
tar -xzf $PHP5.tar.gz

# make folder for libs
mkdir -p php5libs

# change in libs folder
cd php5libs

#get packages
wget http://ftp.gnu.org/pub/gnu/libiconv/$LIBICONF.tar.gz
wget http://easynews.dl.sourceforge.net/sourceforge/mcrypt/$LIBMCRYPT.tar.gz
wget ftp://xmlsoft.org/libxml2/$LIBXML2.tar.gz
wget ftp://xmlsoft.org/libxml2/$LIBXSLT.tar.gz
wget http://easynews.dl.sourceforge.net/sourceforge/mhash/$MHASH.tar.gz
wget http://www.zlib.net/$ZLIB.tar.gz
wget http://curl.haxx.se/download/$CURL.tar.gz
wget ftp://alpha.gnu.org/pub/gnu/libidn/$LIBIDN.tar.gz
wget ftp://ftp.cac.washington.edu/mail/$IMAP.tar.Z

# extract packages
tar -xzf $LIBICONF.tar.gz
tar -xzf $LIBMCRYPT.tar.gz
tar -xzf $LIBXML2.tar.gz
tar -xzf $LIBXSLT.tar.gz
tar -xzf $MHASH.tar.gz
tar -xzf $ZLIB.tar.gz
tar -xzf $CURL.tar.gz
tar -xzf $LIBIDN.tar.gz
tar -xzf $IMAP.tar.Z

# imap
cd $IMAP
# change the makefile and save it to dummy file (111)
sed -e "s/SSLDIR=\/usr\/local\/ssl/SSLDIR=\/usr/g" <src/osdep/unix/Makefile >src/osdep/unix/111
# delete orig. makefile
rm -rf src/osdep/unix/Makefile
# rename (move) dummy to "Makefile"
mv src/osdep/unix/111 src/osdep/unix/Makefile
# build imap
make slx
# no need to "make install"!

# the rest is allways repeating stuff...

#libiconv
cd ../$LIBICONF
./configure -q --enable-extra-encodings --prefix=$HOME/php
make -s
make install

#libxml2
cd ../$LIBXML2
./configure -q --with-iconv=$HOME/php --prefix=$HOME/php
make -s
make install

#libxslt
cd ../$LIBXSLT
./configure -q --prefix=$HOME/php --with-libxml-prefix=$HOME/php --with-libxml-include-prefix=$HOME/php/include/ --with-libxml-libs-prefix=$HOME/php/lib/
make -s
make install

#zlib
cd ../$ZLIB
./configure -q --shared --prefix=$HOME/php
make -s
make install

#libmcrypt
cd ../$LIBMCRYPT
./configure -q --disable-posix-threads --prefix=$HOME/php
make -s
make install

#libmcrypt lltdl issue!!
cd libltdl
./configure -q --prefix=$HOME/php --enable-ltdl-install
make -s
make install

#mhash
cd ../../$MHASH
./configure -q --prefix=$HOME/php
make -s
make install

#libidn
cd ../$LIBIDN
./configure -q --with-iconv-prefix=$HOME/php --prefix=$HOME/php
make -s
make install

#cURL
cd ../$CURL
./configure -q --with-ssl=$HOME/php --with-zlib=$HOME/php --with-libidn=$HOME/php --enable-ipv6 --enable-cookies --enable-crypto-auth --prefix=$HOME/php
make -s
make install

# hey! attention!

#PHP 5
# change the folder
cd ../../$PHP5

# extend the "PATH"-var
export PATH=$HOME/php/bin:$PATH

# configure php5
./configure -q \
--prefix=$HOME/php \
--enable-force-cgi-redirect \
--enable-gd-native-ttf \
--enable-ftp \
--enable-sockets \
--enable-wddx \
--enable-sqlite-utf8 \
--enable-calendar \
--enable-mbstring \
--enable-mbregex \
--enable-soap \
--with-config-file-path=/home/php5dev/etc/php5 \
--with-xml \
--with-libxml-dir=$HOME/php \
--with-openssl=/usr \
--with-mcrypt=$HOME/php \
--with-mhash=$HOME/php \
--with-zlib-dir=$HOME/php \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-gd \
--with-exif \
--with-mysql=/usr \
--with-mysqli \
--without-pear \
--with-gettext \
--with-iconv=$HOME/php \
--with-curl=$HOME/php \
--with-imap=$HOME/src/php/php5libs/$IMAP \
--with-imap-ssl=/usr

# make and install
make -s
make install

# copy config file
cd $HOME
mkdir -p etc/php5
cp $HOME/src/php/$PHP5/php.ini-dist $HOME/etc/php5/php.ini

# copy PHP CGI
cd $HOME
mkdir -p $DOMAIN/cgi-bin
ln -s $HOME/php/bin/php $HOME/$DOMAIN/cgi-bin/php.cgi

# make exeutable
chmod 755 cgi-bin

echo ---------- INSTALL COMPLETE! ----------
#---STOP COPYING---
# now hopefully you are ready to use
 # 


Request

Would somebody please re-write the script on the actual article so that it will actually work with php 5.2.3, and mysql, and fastcgi? Also, if somebody could make an optional addition, a script for installing APC would be nice too. UserFriendly 23:58, 6 June 2007 (PDT)

You're welcome to try the development script, which I've just updated to reflect this change. Feedback is greatly appreciated if you do happen to use it.
As to your request for APC, that would be something for a separate 'add-on' page, which I'll probably get to this weekend. Mousee 06:14, 8 June 2007 (PDT)
Thanks! I will try it, and will look forward to an APC script if/when you make one! UserFriendly 12:21, 8 June 2007 (PDT)

500 error

try adding Options ExecCGI FollowSymLinks to the ,htaccess file

Can't Even Get Basic Exe Working

Bother entioned he can't get the symlink to work, but if he copies the compiled binary across it runs fine. I cant even get tht far. It compiles anexe thats about 21Mb in size, and I cant seem to get it to go any farther. Keep running into the error 500 and the premature end of headers in the log. ANY help here would be greatly appreciated, as all I need to do is get imap commands working from within my PHP script =) FishGuy876

Better Way in php5-install-prep.sh

I would suggest to replace line

uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar x

with

uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar xf -

It will helps people who take those script to FreeBSD or else platform to dearchive correctly.(FreeBSD tar doesn't use stdin but a tape device as default input)

Error building c-client

I'm running php5-install.sh by Charles Wiltgen. I suspect openssl is not installed. the log below ends without error code. Any thoughts?

--- Building: c-client
Making...
make sslnopwd
make[1]: Entering directory `/home/[snip]/source/imap-2004g'
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Building in full compliance with RFC 3501 security requirements:
++ TLS/SSL encryption is supported
++ Unencrypted plaintext passwords are prohibited
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
make[1]: Leaving directory `/home/[snip]/source/imap-2004g'
Applying an process to sources...
tools/an "ln -s" src/c-client c-client
tools/an "ln -s" src/ansilib c-client
tools/an "ln -s" src/charset c-client
tools/an "ln -s" src/osdep/unix c-client
tools/an "ln -s" src/mtest mtest
tools/an "ln -s" src/ipopd ipopd
tools/an "ln -s" src/imapd imapd
tools/an "ln -s" src/mailutil mailutil
tools/an "ln -s" src/mlock mlock
tools/an "ln -s" src/dmail dmail
tools/an "ln -s" src/tmail tmail
ln -s tools/an .
make build EXTRACFLAGS='' EXTRALDFLAGS='' EXTRADRIVERS='mbox' EXTRAAUTHENTICATORS='' PASSWDTYPE=std SSLTYPE=nopwd IP=4 EXTRASPECIALS='' BUILDTYPE=lnp \
SPECIALS="GSSDIR=/usr SSLDIR=/usr SSLINCLUDE=/usr/include/openssl SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private LOCKPGM=/usr/sbin/mlock"
make[1]: Entering directory `/home/[snip]/source/imap-2004g'
Building c-client for lnp...
echo `cat SPECIALS`  > c-client/SPECIALS
cd c-client;make lnp EXTRACFLAGS=''\
EXTRALDFLAGS=''\
EXTRADRIVERS='mbox'\
EXTRAAUTHENTICATORS=''\
PASSWDTYPE=std SSLTYPE=nopwd IP=4\
GSSDIR=/usr SSLDIR=/usr SSLINCLUDE=/usr/include/openssl SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private LOCKPGM=/usr/sbin/mlock
make[2]: Entering directory `/home/[snip]/source/imap-2004g/c-client'
make build EXTRACFLAGS='' EXTRALDFLAGS='' EXTRADRIVERS='mbox' EXTRAAUTHENTICATORS='' PASSWDTYPE=std SSLTYPE=nopwd IP=4 `cat SPECIALS` OS=lnx \
SIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
SPOOLDIR=/var/spool \
ACTIVEFILE=/var/lib/news/active \
RSHPATH=/usr/bin/rsh \
BASECFLAGS="-g -fno-omit-frame-pointer -O2" \
BASELDFLAGS="-lpam -ldl"
make[3]: Entering directory `/home/[snip]/source/imap-2004g/c-client'
sh -c 'rm -rf auths.c crexcl.c nfstest.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE c-client.a || true'
Once-only environment setup...
echo cc > CCTYPE
echo -g -fno-omit-frame-pointer -O2 '' > CFLAGS
echo -DCREATEPROTO=unixproto -DEMPTYPROTO=unixproto \
-DMAILSPOOL=\"/var/spool/mail\" \
-DANONYMOUSHOME=\"/var/spool/mail/anonymous\" \
-DACTIVEFILE=\"/var/lib/news/active\" -DNEWSSPOOL=\"/var/spool/news\" \
-DRSHPATH=\"/usr/bin/rsh\" -DLOCKPGM=\"/usr/sbin/mlock\" > OSCFLAGS
echo -lpam -ldl  > LDFLAGS
echo "ar rc c-client.a osdep.o mail.o misc.o newsrc.o smanager.o utf8.o siglocal.o dummy.o pseudo.o netmsg.o flstring.o fdstring.o rfc822.o nntp.o smtp.o imap4r1.o pop3.o
unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o;ranlib c-client.a" > ARCHIVE
echo lnx > OSTYPE
./drivers mbox imap nntp pop3 mh mx mbx tenex mtx mmdf unix news phile dummy
./mkauths  md5 pla log
make[4]: Entering directory `/home/[snip]/source/imap-2004g/c-client'
echo -DMD5ENABLE=\"/etc/cram-md5.pwd\" >> OSCFLAGS
make[4]: Leaving directory `/home/[snip]/source/imap-2004g/c-client'
ln -s os_lnx.h osdep.h
ln -s os_lnx.c osdepbas.c
ln -s log_std.c osdeplog.c
ln -s sig_psx.c siglocal.c
ln -s crx_nfs.c crexcl.c
ln -s ip4_unix.c ip_unix.c
sh -c '(test -f /usr/include/sys/statvfs.h -a lnx != sc5 -a lnx != sco) && ln -s nfstnew.c nfstest.c || ln -s nfstold.c nfstest.c'
Standard password authentication
ln -s ckp_pam.c osdepckp.c
Building with SSL
ln -s ssl_unix.c osdepssl.c
echo -I/usr/include/openssl -I/usr/include/openssl/openssl -DSSL_CERT_DIRECTORY=\"/etc/ssl/certs\" -DSSL_KEY_DIRECTORY=\"/etc/ssl/private\" >> OSCFLAGS
echo "  ssl_onceonlyinit ();" >> linkage.c
echo -L/usr/lib -lssl -lcrypto  >> LDFLAGS
Building with SSL and plaintext passwords disabled unless SSL/TLS
echo "  mail_parameters (NIL,SET_DISABLEPLAINTEXT,(void *) 2);" >> linkage.c
cat osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c
make[3]: Warning: File `auths.c' has modification time 95 s in the future
Building OS-dependent module
If you get No such file error messages for files x509.h, ssl.h, pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL
is not installed on your system.
Either install OpenSSL first or build with command: make lnx SSLTYPE=none
`cat CCTYPE` -c `cat CFLAGS` `cat OSCFLAGS` -c osdep.c
`cat CCTYPE` -c `cat CFLAGS` mail.c
`cat CCTYPE` -c `cat CFLAGS` misc.c
`cat CCTYPE` -c `cat CFLAGS` newsrc.c
`cat CCTYPE` -c `cat CFLAGS` smanager.c
`cat CCTYPE` -c `cat CFLAGS` utf8.c
`cat CCTYPE` -c `cat CFLAGS` siglocal.c
`cat CCTYPE` -c `cat CFLAGS` dummy.c
`cat CCTYPE` -c `cat CFLAGS` pseudo.c
`cat CCTYPE` -c `cat CFLAGS` netmsg.c
`cat CCTYPE` -c `cat CFLAGS` flstring.c
`cat CCTYPE` -c `cat CFLAGS` fdstring.c
`cat CCTYPE` -c `cat CFLAGS` rfc822.c
`cat CCTYPE` -c `cat CFLAGS` nntp.c
`cat CCTYPE` -c `cat CFLAGS` smtp.c
`cat CCTYPE` -c `cat CFLAGS` imap4r1.c
`cat CCTYPE` -c `cat CFLAGS` pop3.c
`cat CCTYPE` -c `cat CFLAGS` unix.c
`cat CCTYPE` -c `cat CFLAGS` mbx.c
`cat CCTYPE` -c `cat CFLAGS` mmdf.c
_unix.c osdepssl.c
echo -I/usr/include/openssl -I/usr/include/openssl/openssl -DSSL_CERT_DIRECTORY=\"/etc/ssl/certs\" -DSSL_KEY_DIRECTORY=\"/etc/ssl/private\" >> OSCFLAGS
echo "  ssl_onceonlyinit ();" >> linkage.c
echo -L/usr/lib -lssl -lcrypto  >> LDFLAGS
`cat CCTYPE` -c `cat CFLAGS` tenex.c
Building with SSL and plaintext passwords disabled unless SSL/TLS
echo "  mail_parameters (NIL,SET_DISABLEPLAINTEXT,(void *) 2);" >> linkage.c
cat osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c
make[3]: Warning: File `auths.c' has modification time 95 s in the future
Building OS-dependent module
If you get No such file error messages for files x509.h, ssl.h,
pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL is not installed on your system.
Either install OpenSSL first or build with command: make lnx SSLTYPE=none
`cat CCTYPE` -c `cat CFLAGS` `cat OSCFLAGS` -c osdep.c
`cat CCTYPE` -c `cat CFLAGS` mail.c
`cat CCTYPE` -c `cat CFLAGS` misc.c
`cat CCTYPE` -c `cat CFLAGS` n`cat CCTYPE` -c `cat CFLAGS` mtx.c
`cat CCTYPE` -c `cat CFLAGS` news.c
news.c: In function `news_open':
news.c:347: warning: passing arg 3 of `scandir' from incompatible pointer type
`cat CCTYPE` -c `cat CFLAGS` phile.c
`cat CCTYPE` -c `cat CFLAGS` mh.c
mh.c: In function `mh_ping':
mh.c:688: warning: passing arg 3 of `scandir' from incompatible pointer type
mh.c: In function `mh_append':
mh.c:938: warning: passing arg 3 of `scandir' from incompatible pointer type
`cat CCTYPE` -c `cat CFLAGS` mx.c
mx.c: In function `mx_ping':
mx.c:647: warning: passing arg 3 of `scandir' from incompatible pointer type
sh -c 'rm -rf c-client.a || true'
ar rc c-client.a osdep.o mail.o misc.o newsrc.o smanager.o utf8.o siglocal.o dummy.o pseudo.o netmsg.o flstring.o fdstring.o rfc822.o nntp.o smtp.o imap4r1.o pop3.o unix.o
mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o;ranlib c-client.a
make[3]: *** Deleting file `c-client.a'
make[3]: *** [c-client.a] Interrupt
make[2]: *** [lnp] Interrupt
make[1]: *** [OSTYPE] Interrupt
make: *** [ldb] Interrupt

—The preceding unsigned comment was added by Eric.lannert (talkcontribs) .

libXML vs. SAX?

at some point during install, I saw a message scroll by warning it that LibXML is obsolete and recommends using XM.SAX instead. --Hudsonic 19:25, 25 September 2007 (PDT)

While this is true, not all PHP-based applications/scripts necessarily support SAX and thus it's best to leave LibXML in the current script as the default. The next complete version of the development script I've been working will include an option during the installation process which will prompt users to install such features (defaults will be stable/proven dependencies). This way everyone gets what they want ;) - Mousee 08:32, 26 September 2007 (PDT)