Jump to content

Compiling my own custom php


Recommended Posts

Hello

 

I'm using this tutorial to compile my own version of php that support fwrite and fopen:

http://www.hiveminds.co.uk/node/3201

 

For some reason the script only works within the domain of the original installation, I've followed all of the instructions: the second shell script successfully creates a new folder in in php5 with the new domain name as well as a cgi-bin (although it only has a php.cgi and not a php.fcgi) in the new domain. When I try a phpinfo the version of php is evidently the one on the server. What could be wrong? Are there alternatives methods to go about this? Thanks for reading!

 

Link to comment
Share on other sites

Yes. fwrite and fopen are part of php's core functionality.

 

Anyway... the first question I'll ask is, what type of hosting do you have? Is it one of the ones spoken of in the tutorial or a vps or simular?

 

Just if its a vps there are much simpler ways of going about this.

Link to comment
Share on other sites

You can't compile php without support for fwrite or fopen, maybe you meen url_wrappers are disabled? You should be able to tunr these on via a simple change to your php.ini... assuming you have access to it.

 

Are there alternatives methods to go about this?

 

Your probably going to need to do some debugging of the script to see what is happening. Change...

 

#copy PHP CGI and FCGI
mkdir -p ${HOME}/${DOMAIN}/cgi-bin
chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php.cgi
cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php5.fcgi
rm -fr $SRCDIR $DISTDIR

 

to....

 

#copy PHP CGI and FCGI
mkdir -p ${HOME}/${DOMAIN}/cgi-bin
chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
cp -v ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php.cgi
cp -v ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php5.fcgi
rm -fr $SRCDIR $DISTDIR

 

And let me know if you get any output.

Link to comment
Share on other sites

Hm You mean to swapping those changes in the first script?

That one actually worked and I have a folder called 'php5' before my domains, and the domain I name in that first installation is running that new version of php.

I'm afraid that if I run that script again with the changes I might ruin something that was already working in the first place or make matters worse.... My actual problem is with redirecting that existing version of php into another domain on the same account. Do you think that swap will fix that?

Link to comment
Share on other sites

Ok, now I'm with you. Well, I see what your problem might be anyway. Sorry, I haven't used any host like this. I'll need to spend a little more time looking at the scripts to actually see what they are doing.

 

I haven't really got time at the moment, but I will try and get back to it. So its the second script your having trouble with? This script is meant to copy your new install to another domain? I'll just have a quick look.

Link to comment
Share on other sites

Ok... try this as your second script.

 

#!/bin/sh

# Abort on any errors
set -e

# And where should it be installed?
DOMAIN="hiveminds.co.uk"

#copy it for where?
SOURCEDOMAIN="demo.hiveminds.co.uk"

#paths
INSTALLDIR=${HOME}/php5
CGIFILE="$HOME/$SOURCEDOMAIN/cgi-bin/php.cgi"
INIFILE="$HOME/php5/etc/php5/$SOURCEDOMAIN/php.ini"

#copy config file
mkdir -p ${INSTALLDIR}/etc/php5/${DOMAIN}
cp ${INIFILE} ${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
cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php5.fcgi

echo ---------- INSTALL COMPLETE! ----------

 

You did setup the .htaccess as sugested?

Link to comment
Share on other sites

Yes I have the .htaccess, One question though just to make sure I'm doing this right, in the part of the script that says

 

# And where should it be installed?
DOMAIN="hiveminds.co.uk"

 

I should write the new domain while at

SOURCEDOMAIN="demo.hiveminds.co.uk"

I should write the one that's already working right?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.