Hi folks,
I am trying to set up on localhost multiple versions between mysql and php.
So for example I could switch with a script or anything to run mysql 4.1 with php5
or mysql 4.0 with php4.0 etc etc.
Are there any tips & tricks you could give to achieving this or should I just straigstforward install stuff. and run some script to switch configuration.
I am running Slackware current btw.
10x in advance for spending time.
running multiple php/mysql versions
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
The trick with running multiple versions of PHP is to use CGI along with some <Directory> directives in your httpd.conf file.
Install each version of PHP in a different location and ScriptAlias the php-cgi for each one inside <Directory> blocks as per your needs.
You can also run one version of PHP is a module alongside this.
As for MySQL you need to install multiple versions in different locations again and bind them to different ports. Ahhh... but stop, it's get's better in linux
If this is just for development on localhost then you can totally run everything on standard ports but use different IP addresses. To do that you just alias any private IP's you want to the network interface of your choice:
So in your MySQL config you bind to whatever IP you want to and then in your PHP scripts you put that IP down for mysql_connect(). It's all very nifty 
Install each version of PHP in a different location and ScriptAlias the php-cgi for each one inside <Directory> blocks as per your needs.
You can also run one version of PHP is a module alongside this.
As for MySQL you need to install multiple versions in different locations again and bind them to different ports. Ahhh... but stop, it's get's better in linux
If this is just for development on localhost then you can totally run everything on standard ports but use different IP addresses. To do that you just alias any private IP's you want to the network interface of your choice:
Code: Select all
ifconfig eth0 192.168.1.1
ifconfig eth0:1 192.168.1.2
ifconfig eth0:2 192.168.1.3I am not sure if this is what I am trying to do.
The idea is not to run multiple versions etc simultaniuously.
But rather to be able to swtich. So at one point I run under php4.0
And when switch.....refresh...voala php5. (I will keep only one instance of the code....running under different php version.)
with mysql I guess I will have to have several servers (databases) as switching is kind of weird ....will break data and stuff.
The idea is not to run multiple versions etc simultaniuously.
But rather to be able to swtich. So at one point I run under php4.0
And when switch.....refresh...voala php5. (I will keep only one instance of the code....running under different php version.)
with mysql I guess I will have to have several servers (databases) as switching is kind of weird ....will break data and stuff.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Wouldn't you be able to acheive that by running multiple versions alongside. Then change "192.168.1.1" in your address bar to "192.168.1.2" to view it in PHP5 with MySQL 4.1 and Apache 1.3 etc?jmut wrote:I am not sure if this is what I am trying to do.
The idea is not to run multiple versions etc simultaniuously.
But rather to be able to swtich. So at one point I run under php4.0
And when switch.....refresh...voala php5. (I will keep only one instance of the code....running under different php version.)
with mysql I guess I will have to have several servers (databases) as switching is kind of weird ....will break data and stuff.
That's sort of what I do
I have roughly 12 versions of PHP, 4 version of MySQL and around 6 version of Apache currently installed on one dev machine. Each one is compiled into it's own directory within /usr/local (i.e. /usr/local/app-version). From that I symlink which ever version I need into /usr/local/app so switching versions is a simple case of updating/changing one symlink.
I'n many cases/versions, you can point different MySQL versions at a single data directory but I wouldn't recommend it, I prefer (and recommend) to keep version specific data directories.
I also keep a library of PHP apache modules again with a symlink pointing to which ever version I require, which means my httpd.conf file just loads the module that the particular symlink is pointing to. For switching/loading of PHP 4 vs 5 you can pass a define in when starting apache (using the -D switch) then within your httpd.conf file have your LoadModule declarations with <IfDefine> blocks.
I'n many cases/versions, you can point different MySQL versions at a single data directory but I wouldn't recommend it, I prefer (and recommend) to keep version specific data directories.
I also keep a library of PHP apache modules again with a symlink pointing to which ever version I require, which means my httpd.conf file just loads the module that the particular symlink is pointing to. For switching/loading of PHP 4 vs 5 you can pass a define in when starting apache (using the -D switch) then within your httpd.conf file have your LoadModule declarations with <IfDefine> blocks.
For what it's worth, both Windows (at least Win2K so presumably XP) and MAC OS X allow binding multiple IPs to a single physical interface.d11wtq wrote: Ahhh... but stop, it's get's better in linux
If this is just for development on localhost then you can totally run everything on standard ports but use different IP addresses. To do that you just alias any private IP's you want to the network interface of your choice:
So in your MySQL config you bind to whatever IP you want to and then in your PHP scripts you put that IP down for mysql_connect(). It's all very niftyCode: Select all
ifconfig eth0 192.168.1.1 ifconfig eth0:1 192.168.1.2 ifconfig eth0:2 192.168.1.3![]()
-
asgerhallas
- Forum Commoner
- Posts: 80
- Joined: Tue Mar 14, 2006 11:11 am
- Location: Århus, Denmark
What about maintenace?
Currently we run PHP 4.3 / MySQL 4.0.x - we would like to run PHP 5 + MySQL 5 both on another port ( 81, for example). The initial concern was ease of maintenance. Will we be able to update automatically using Red Hat's up2date or RPM ?