Custom PHP install

Custom PHP install

Posted by: memco
Posted on: 2006-10-07 23:33:00

I was following the instructions for a custom php5 install from the DH wiki, and had this error:

In reply to:


gcc: Internal error: Killed (program collect2)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-3.3/README.Bugs>.

make: *** [sapi/cli/php] Error 1



What can I do to finish compiling? Do I have to restart the whole process and how do I avoid the same error?

Re: Custom PHP install

Posted by: rlparker
Posted on: 2006-10-07 23:59:00

make "nice"?
--rlparker

Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-08 00:14:00

I get this, "make: *** No rule to make target `nice'. Stop."

Re: Custom PHP install

Posted by: rlparker
Posted on: 2006-10-08 00:31:00

What did you type to get that? I'm sorry for not being more clear. What I should have said was, "Did you try running make in "nice" mode?

man nice - if you are not familiar with it.

--rlparker

Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-11 11:57:00

Here's the script I'm using:

#!/bin/bash

# Abort on any errors
set -e

# The domain in which to install the PHP CGI script.
export DOMAIN="YOURDOMAIN"

# 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}/php5

# 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.
PHP5="php-5.1.6"
LIBICONV="libiconv-1.11"
LIBMCRYPT="libmcrypt-2.5.7"
LIBXML2="libxml2-2.6.26"
LIBXSLT="libxslt-1.1.17"
MHASH="mhash-0.9.7.1"
ZLIB="zlib-1.2.3"
CURL="curl-7.15.5"
LIBIDN="libidn-0.6.7"
CCLIENT="imap-2004g"
CCLIENT_DIR="imap-2004g" # Another pest!

# What PHP features do you want enabled?
PHPFEATURES="--prefix=${INSTALLDIR}
--with-config-file-path=${INSTALLDIR}/etc/php5/${DOMAIN}
--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-mysql=/usr
--with-mysqli
--without-pear
--with-gettext
--with-imap=${INSTALLDIR}
--with-imap-ssl=/usr"

# ---- 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://us3.php.net/distributions/${PHP5}.tar.gz
wget -c http://mirrors.usc.edu/pub/gnu/libiconv/${LIBICONV}.tar.gz
wget -c http://easynews.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.7.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://superb-west.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/old/${CCLIENT}.tar.Z

echo ---------- Unpacking downloaded archives. This process may take several minutes! ----------

cd ${SRCDIR}
# Unpack them all
tar xzf ${DISTDIR}/${PHP5}.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

# Build them in the required order to satisfy dependencies.

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

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

#libxslt
cd ${SRCDIR}/${LIBXSLT}
./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}
./configure --shared --prefix=${INSTALLDIR}
# make clean
make
make install

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

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

#mhash
cd ${SRCDIR}/${MHASH}
./configure --prefix=${INSTALLDIR}
# make clean
make
make install

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

#cURL
cd ${SRCDIR}/${CURL}
./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}/${PHP5}
./configure ${PHPFEATURES}
# make clean
make
make install

#copy config file
mkdir -p ${INSTALLDIR}/etc/php5/${DOMAIN};
cp ${SRCDIR}/${PHP5}/php.ini-dist ${INSTALLDIR}/etc/php5/${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! ----------

Re: Custom PHP install

Posted by: rlparker
Posted on: 2006-10-11 12:11:00

Ok. I'm sorry, but I dont understand. What is your question? I thought that your problem was that your "make" processes were being killed before execution was completed. My suggestion was that you run your "makes" using "nice" mode, and I pointed you to the man page for using nice.

Did you research the use of nice? wink You probably need to study-up a bit on the process of compiling programs within the shell (there are *lots* of web resources available for that).

While I did not carefully study your script, I do not see anywhere you used nice in the makes.

I'm also curious as to why you need to compile your own PHP5, as Dreamhost now makes PHP5 available from the panel? If all you need are a few settings changes, it is *much easier* to just use your own copy of PHP and a customized php.ini (which is described well on the wiki).

--rlparker

Edited by rlparker on 10/11/06 12:18 PM (server time).

Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-11 12:35:00

No, I didn't add nice to the script. I was just showing how I came up with my errors. My goal is to install php so that I can have imap support, and I found this script on the DH wiki here: http://wiki.dreamhost.com/index.php/Installing_PHP5 to do the install. I'm going to add the -k modifier to the makes to see if that helps. I don't quite understand how nice will help with the install.

Re: Custom PHP install

Posted by: rlparker
Posted on: 2006-10-11 12:57:00

I understand. Nice *might* not help, but it is designed to make the compile use less resources, and submit to other processes, in order to allow the complile to "play nice"wink. My thought was that it might help prevent your process(es) from getting killed during a make.

The -k might also help. Good Luck with it!

--rlparker



Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-11 13:20:00

I hit more erros. This time it is:

make: *** [sapi/cli/php] Killed
make: *** Deleting file `sapi/cli/php'
Killed
make: Target `all' not remade because of errors.
[lira]$ /home/flccorg/php5/lib/libc-client.a(osdep.o)(.text+0x9180): In function `ssl_onceonlyinit':
/home/flccorg/source/imap-2004g/c-client/osdep.c:300: warning: the use of `tmpnam' is dangerous, better use `mkstemp'

it looks as though PHP was installed (at least all the modules were, but I don't know how to finish the install).

Re: Custom PHP install

Posted by: rlparker
Posted on: 2006-10-11 13:28:00

Wow, you're having a terrible time getting that install to run without getting killed, and I don't know what else to suggest other than breaking your script up into pieces and trying to run them one after the other (and I'm not even sure that will help, cause I'm not sure what DH is using to determine when to kill your process) frown

After trying breaking up the script, if I still couldn't get a clean run, I think I'd contact support, pointing them to this thread so they can see what you have gone through. Maybe they can either relax your process control limitations long enough for you to get a clean run of your script, or maybe even run it for you.

--rlparker

Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-11 15:01:00

I appreciate all the help. At this point I'll try adding nice. I've reduced the script down some, but I'm having trouble figuring out where it crashed. If I could get that I might be able to resume from that point.

Re: Custom PHP install

Posted by: pangea33
Posted on: 2006-10-11 17:53:00

I was trying to get AWStats configured properly, and was running it with the first line. It would typically take about 10-15 seconds, can't remember the exact time, but would get killed during processing about half the time.

I started using the second line and while it now took 20-30 seconds, it never once got killed. You've probably got all this figured out by now, but I just wanted to comment that it wasn't terribly frustrating in my experience.

"/usr/local/bin/perl /home/username/awstats/tools/awstats_buildstaticpages.pl -config=domain.com -update -awstatsprog=/home/username/awstats/cgi-bin/awstats.pl -dir=/home/username/domain.com/statistics/"

"nice -20 /usr/local/bin/perl /home/username/awstats/tools/awstats_buildstaticpages.pl -config=domain.com -update -awstatsprog=/home/username/awstats/cgi-bin/awstats.pl -dir=/home/username/domain.com/statistics/"

How long does this make process you're running typically take? There's a LOT going on it looks like.

http://benconley.net
http://teamshocker.com

Re: Custom PHP install

Posted by: memco
Posted on: 2006-10-12 10:03:00

The make process takes a long time. I'm not sure about the particular package you're installing, but it'll take at least 30 minutes I'm guessing.

Re: Custom PHP install

Posted by: therealjlo
Posted on: 2007-10-27 12:53:00

I believe your solution is to replace the "DOMAIN" in the line

export DOMAIN="DOMAIN"

to use your domain name as it is at DH...

export DOMAIN="putyourdomainhere.com"

That's in the instructions on the page with the scripts.

Tags: bug reportphp5gccwikiphpinternal error