Talk:PHP 5 install script

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 ---

# export DOMAIN=YOUR.DOMAIN
 * 1) ---COPY ALL THIS---
 * 2) CHANGE THIS TO YOUR DOMAIN NAME:

export PHP5=php-5.1.2
 * 1) Change this to the PHP Version of your choice

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
 * 1) Change this to the last working Libs (may be you have to try and error)

cd $HOME
 * 1) setup directories
 * 2) change to the right folder. always.

mkdir -p php
 * 1) make folder for the executables

mkdir -p src/php
 * 1) make folder for the sources

cd src/php
 * 1) change to source folder

wget http://us3.php.net/distributions/$PHP5.tar.gz
 * 1) get PHP

tar -xzf $PHP5.tar.gz
 * 1) extract php

mkdir -p php5libs
 * 1) make folder for libs

cd php5libs
 * 1) change in libs folder

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
 * 1) get 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
 * 1) extract packages

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


 * 1) the rest is allways repeating stuff...

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

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

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
 * 1) libxslt

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

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

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

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

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

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
 * 1) cURL


 * 1) hey! attention!

cd ../../$PHP5
 * 1) PHP 5
 * 2) change the folder

export PATH=$HOME/php/bin:$PATH
 * 1) extend the "PATH"-var

./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
 * 1) configure php5

make -s make install
 * 1) make and install

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

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

chmod 755 cgi-bin
 * 1) make exeutable

echo -- INSTALL COMPLETE! -- #
 * 1) ---STOP COPYING---
 * 2) 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 (talk • contribs).

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)

New Version?
Has anyone seen this version from the discussion forum?

It keeps looping forever when it gets to install and i can't figure it out!
 * Yeah .. it's not yet ready for "prime time" - Rlparker 07:49, 16 May 2008 (PDT)


 * Additionally, it has been brought to my attention that there is no clear license stated for this code and, as it was uploaded to this wiki by other than it's author (who by so doing would have granted the appropriate license), absent any clearly stated permission by the author in the code, it may not be appropriate, or legal, to include this code in this wiki. In the United States, copyright automatically accrues to the author of a work, and only the holder of the copyright may determine the method by, or manner in, which said work may be copied.  For this reason, I have removed the copy of the work from this page (leaving the link to the original posting by the author for reference).  If you want to discuss, or criticize, a specific piece of the code which was publicly published elsewhere (in the forum, for example), then you might be able to make a "fair use" argument for re-publishing a limited portion of the code for that purpose, but you will need to articulate that fair use argument when doing so. Additional information, see Copyrights. Thanks! - Rlparker 22:33, 16 May 2008 (PDT)

(Code removed due to copyright concerns)

PHP 5.2.6
Any body come up with an updated script to compile PHP 5.2.6 on Dreamhost?
 * DH already started rolling the new update to some of their servers, I can confirm that Spyro and Tonic use it already. --Locutus 07:40, 13 June 2008 (PDT)
 * Link?

Bad link for 5.2.5
Apparently, the 5.2.5 package this script tries to download from http://us.php.net/get/php-5.2.5.tar.gz/from/a/mirror is no longer available. The script downloads the 404 html page, continues downloading other packages, and later failed as it tries to use that package. --Mattgilbert 20:20, 18 June 2009 (UTC)
 * The openssl link is also dead. If there's a newer version of this script, or any version that supports > 5.2.5, I haven't found it. --Mattgilbert 20:29, 18 June 2009 (UTC)
 * After making sure all the links were legit, switching to 5.2.6 and changing all other package numbers and links to match a different installation that's known to work fine (not always the most recent packages), and cleaning up after previous install attempts, it finally installed. If it tests well I'll post it. --Mattgilbert 22:05, 18 June 2009 (UTC)