I want a test- and development-environment for web using Apache, PHP and MySQL. I need to be able to test a single web-application with multiple versions of PHP (5.2, 5.3, etc) and multiple versions of MySQL (5.0, 5.1, 5.5, etc). It shall be hosted on a FreeBSD server.

My idea is to compile each version into a directory structure and running them on separate portnumbers. For example:

(httpd on port 8801, mysql on port 8802)
(directory contains each software, compiled and linked towards eachother)

(httpd on port 8803, mysql on port 8804)
(and so on)

Any thoughts or suggestions of the best way to setup this type of environment?

UPDATE (background information): The environment would be for education. I have x00 students who develop webapplications and they have a directory where they store all their code (HTML, CSS, PHP, SQL etc). I would like to give them an easy way to test their applications on various versions of PHP and MySQL. There is no need, at this stage, to have different versions of the Apache httpd-server.

UPDATE (can not use Ports for installing): I can not use ports for keeping the software updated. I might need to install a very specific version of, for example MySQL, to perform some detailed testing using this particular version. It seems like compiling from source would be the only alternative.


Use FreeBSD jails. It is like running multiple instances of FreeBSD on a single FreeBSD installation.

Read about FreeBSD jails in the FreeBSD handbook:


  • Thx, reviewed jails in the manual. Put some additional information in the original question. Hope to solve it without jail, at least to begin with. But still, virtualization using jail might be a proper way to move on. I need to read more on jail. – Mikael Roos May 27 '10 at 7:30

This should work, although some diligence will be necessary to set it up.

While it might be possible through separate config files, I recommend having a complete instance of the whole stack for each testing arrangement, because it will best replicate the real world situation you are trying to test.

You may want to setup the nginx proxy/rewrite engine to manage the traffic. You may also want to setup "virtual hosts", i.e have a single IP for each desired configuration. Or you might want to do both.

  • Thx, I'll consider using a proxy/rewrite engine as a frontend. That way I can have one domainaddress for each testenvironment. For example: php52-mysql50.mydomain.org or php53-mysql51.mydomain.org. Maybe Apache mod_proxy or even (simpler) mod_rewrite could do the trick. All I would need is to rewrite: php52-mysql50.mydomain.org -> php52-mysql50.mydomain.org:8801. This would actually be a nice frontend. Thx for pointing me in this direction. – Mikael Roos May 27 '10 at 7:04
  • One reason to avoid using Apache is that Apache is part of the stack that you are testing, so you want to avoid screwy configuration for Apache. Better to have a standalone stack for each desired configuration on a unique IP:port, separate domains if you wish, and the rewrite engine listening on port 80. – tomjedrz May 28 '10 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.