Forum Moderators: coopster

Message Too Old, No Replies

Problem with compiling PHP

         

estriker

12:54 am on Nov 16, 2005 (gmt 0)

10+ Year Member



One of the host's I use is Dreamhost,

A script that I use for my sites requires fopen to be allowed, and DH disables it.

A suggestion that Dreamhost gives, is to compile your own PHP and then let your sites use that.

They provide a PHP installscript:

#---COPY ALL THIS---
#CHANGE THIS TO YOUR DOMAIN NAME:
export DOMAIN=YOURDOMAIN.COM
#setup directories
cd ~
mkdir -p php
mkdir -p src/php
cd src/php
#get PHP and extract
wget [us4.php.net...]
tar -xzf php-4.3.11.tar.gz
mkdir -p php4libs
cd php4libs
#get packages
wget [ftp.gnu.org...]
wget [unc.dl.sourceforge.net...]
wget [xmlsoft.org...]
wget [xmlsoft.org...]
wget [unc.dl.sourceforge.net...]
wget [zlib.net...]
wget [curl.haxx.se...]
wget ftp://alpha.gnu.org/pub/gnu/libidn/libidn-0.5.9.tar.gz
wget ftp://ftp.cac.washington.edu/imap/imap-2004e.tar.Z
tar -xzf libiconv-1.9.2.tar.gz
tar -xzf libmcrypt-2.5.7.tar.gz
tar -xzf libxml2-2.6.18.tar.gz
tar -xzf libxslt-1.1.13.tar.gz
tar -xzf mhash-0.9.2.tar.gz
tar -xzf zlib-1.2.2.tar.gz
tar -xzf curl-7.13.1.tar.gz
tar -xzf libidn-0.5.9.tar.gz
uncompress imap-2004e.tar.Z
tar -xvf imap-2004e.tar

#libiconv
cd libiconv-1.9.2
./configure --enable-extra-encodings --prefix=$HOME/php
make
make install
#libxml2
cd ../libxml2-2.6.18
./configure --with-iconv=$HOME/php --prefix=$HOME/php
make
make install
#libxslt
cd ../libxslt-1.1.13
./configure --with-libxml-prefix=$HOME/php --prefix=$HOME/php
make
make install
#zlib
cd ../zlib-1.2.2
./configure --shared --prefix=$HOME/php
make
make install
#libmcrypt
cd ../libmcrypt-2.5.7
./configure --disable-posix-threads --prefix=$HOME/php
make
make install
#mhash
cd ../mhash-0.9.2
./configure --prefix=$HOME/php
make
make install
#libidn
cd ../libidn-0.5.9
./configure --with-iconv-prefix=$HOME/php --prefix=$HOME/php
make
make install
#cURL
cd ../curl-7.13.1
./configure --with-ssl=$HOME/php --with-zlib=$HOME/php --with-libidn=$HOME/php --enable-ipv6 --enable-cookies --enable-crypto-auth --prefix=$HOME/php
make
make install
#IMAP
cd ../imap-2004e
make ldb
mkdir include
mkdir lib
cp c-client/*.c lib
cp src/c-client/*.c lib
cp c-client/*.h include
cp src/c-client/*.h include
cp c-client/c-client.a lib/libc-client.a
#PHP 4
cd ../../php-4.3.11
export PATH=$HOME/php/bin:$PATH
./configure --prefix=$HOME/php --with-config-file-path=$HOME/etc/php4 --enable-force-cgi-redirect --with-xml --with-libxml-dir=$HOME/php --enable-soap --with-xsl=$HOME/php --with-openssl=/usr --with-mhash=$HOME/php --with-mcrypt=$HOME/php --with-zlib-dir=$HOME/php --with-jpeg-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --enable-ftp --enable-sockets --enable-wddx --with-iconv=$HOME/php --enable-sqlite-utf8 --enable-calendar --with-curl=$HOME/php --enable-mbstring --enable-mbregex --with-mysql=/usr --with-mysqli --with-imap=$HOME/src/php/php4libs/imap-2004e
make
make install
#copy config file
cd $HOME
mkdir -p etc/php4
cp $HOME/src/php/php-4.3.11/php.ini-dist $HOME/etc/php4/php.ini
#copy PHP CGI
cd $HOME/$DOMAIN/
mkdir -p cgi-bin
cp $HOME/php/bin/php $HOME/$DOMAIN/cgi-bin/php.cgi
chmod 755 cgi-bin
echo ---------- INSTALL COMPLETE! ----------
#---STOP COPYING---

you enter the domain name you want to use this PHP for in the script, and then all you have to do once it has compiled is add this to your sites htaccess:

AddHandler phpFour .php
Action phpFour /cgi-bin/php.cgi

So I did this with one of my sites, it created the cgi-bin folder in my domains folder, and I added those two lines to my htaccess, and it worked fine.

The problem I have is,

I want to use my own PHP for all of my domains, I thought that I could just copy the cgi-bin folder from the one domain, into all my other domains, and then add the:

AddHandler phpFour .php
Action phpFour /cgi-bin/php.cgi

to each of my different domains htaccess. However this does not work, it gives me the 500 Internal Server Error.

The only way to get my own PHP to work for each domain, is to run the installscript for each of my domain names, and this just takes too much time.

Is there any reason that copying the cgi-bin folder and then editing the htaccess doesnt work?

coopster

5:06 am on Nov 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, estriker.

My guess would be that each domain has it's own user profile which means they have different authorizations on the server. One won't be able to share the resources owned by the other. One way to get away from that particular problem may be a dedicated server. Then you could set it up and share code respositories throughout your sites on that same server.