Click to See Complete Forum and Search --> : PHP Upgrading (for pre-schoolers)


Cinquecento
05-13-2003, 11:10 AM
Hi,

I rent a server (matrix Linux) that runs PHP 4.01. I'm desperate to get access to GD2 - but the usual automated updates (initialised through a web gui) haven't appeared - and the host is next to useless - so it's up to me!

When I read the hosts forums from others about updating PHP there is mention of all sorts of pitfalls....

/////----SNIP-------//////

apache built with mod_so so in theory you could upgrade.

problem is IIRC you need apache source code, if you check out phpinfo for the configure command they use ../apache-1.3.12 as the path for config although you should in theory be able to replace that with --with-apxs=/usr/ins/intel/apache/bin/apxs

backup the libexec/libphp4.so and php.ini

doing the configure first will hint if its possible.

only other issues is it compatible with mod_iasp.so build (see weblog warning on apache restart)


///////--------SNIP-------///////


Whilst I've been happy to fiddle about with the server - I fear I'm REALLY going to screw things up if I just try and 'get on with it' - and potentially take six of my clients websites out in the process.

Has anyone got any grass-roots advice/tutorials about installing PHP and/or Apache in PARALLEL with an existing installation. I really need some simple guide so I can at least begin my learning - everything I read seems to assume that I'm already experienced,.


Ian

tsinka
05-19-2003, 04:54 PM
Hi,

installing a php enabled apache parallel to an existing install can sometimes be a hard job but you can do it at all. I can give you a step by step list of how to do that. But you need to change the port the custom apache listens on so you can access the new instance by e.g. http://www.thehost.com:8080/.

With the console command netstat -an you can see which ports are already occupied by services.

You can compile apache so that all files belonging to that instance will be installed to one directory and subdirectories in that directory.

I'll try to do it as simple as possible. It

a)
create a script like info.php to be displayed with your existing installation:

<?PHP
phpinfo();
?>

Near the top of the output you'll see the configuration parameters php has been compiled with. Chances are good that you'll be able to successfully compile php by using the same configure parameters (adjusting the --with-apache=../apache-1.3.12 switch).

b)
download the latest php and apache-1.3.x source packages and unzip them to a directory like /usr/src.

c)
cd to that directory and uncompress the packages with e.g.

tar xvzf apache-1.3.27.tar.gz
tar xvzf php-4.3.1.tar.gz

I assume that this will create the two directories apache_1.3.27 and php-4.3.1

d)
cd to apache_1.3.27 and execute configure, e.g.:

./configure --prefix=/usr/local/apache --with-port=8080

set prefix to the directory where you want and port to a free port.

e)
cd to php-4.3.1 and execute:

./configure --with-apache=../apache_1.3.27

and add all the switches you saw on output of the info script (excluding --with-apache=../apache-1.3.12).

f)
execute make

this might be the hardest part, if errors occur :(

Please post them if any occur.

g)
execute make install

h)
cd to apache_1.3.27

./configure --prefix=/usr/local/apache --with-port=8080 --enable-module=most --enable-shared=max --activate-module=src/modules/php4/libphp4.a

i)
make

j)
make install

k)
edit /usr/local/apache/conf/httpd.conf and insert the line

AddType application/x-httpd-php .php .phtml

somewhere below the LoadModule and AddModule sections, e.g. where the tgz type is added.

It might then look like

AddType application/x-tar .tgz
AddType application/x-httpd-php .php .phtml

l)
start apache with

/usr/local/apache/bin/apachectl start

In best case apache starts and you should then be able to access the new instance with

http://www.mysite.com:8080/myscript.php.

The scripts and html pages have to be copied to <installdir>/htdocs, in the above example /usr/local/apache/htdocs.

The most annoying part could be the compilation of php if there are some libraries missing.

You can see what extensions are available by executing

./configure --help in php-4.3.1.


I know it looks a little bit complicated, but it should work.

T.

Cinquecento
05-19-2003, 08:04 PM
That doesn't sound too bad - I'm just terrified about screwing things up and being unable to repair things.

You may have guessed - I'm used to GUI's - so all this command line stuff is a bit scary.

I'm leaving it a couple of days to see what the host comes up with - then I might have a go!

thanks again

Ian