I have heard that setting the --prefix=PREFIX option when compiling PHP on linux will allow you to have more than one install of PHP at a time without them clashing. (I think the default if this isn’t set is /usr/local). However, I’m not sure what exactly it does or what a good setting to use is. Furthermore, I’ve also heard that setting it to something other than the default value might make some PHP extensions harder to install.
./configure --prefix=PREFIX ...
I just realized that some of the other options such as --exec-prefix might still need to be set to /usr/local since they default to the value of --prefix. This would cause problems if prefix was set to something like web/phpalt because things like the --sbindir is set to “–exec-prefix + /sbin`.
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
Based on what PHP is saying then it seems like you could set the following options without any side affects.
./configure --prefix=/custom/path --exec-prefix=/usr/local
However, this is just a guess.
If you want to switch between 5.2 and 5.3, you’re probably better off compiling both Apache and PHP from source, into special directories.
Basically, you could compile apache and php5.2 to some place like /web/php52 (giving –prefix=/web/php52 to
configurefor both apache and php. Then do the same for apache/php53 with a prefix like /web/php53You could even get tricky and do things like symlink various configs between the two apache installations to keep things consistent (so the only difference is that one is running 5.3 and the other 5.2)
Then when you want to start up your 5.2 server, you just say:
and then to switch over to 5.3
I have some (old) build scripts available that may or may not save you some pain if you’re compiling on linux (CentOS in particular, but you could make it work pretty easily on non-redhat distros, too)