VAMPP: Virtual Apache, MySQL, PHP, Perl ... and More

VAMPP: Virtual Apache, MySQL, PHP, Perl ... and More
Jordan's picture

Anyone who has worked as a professional Web designer or developer will swear by having a test server on a machine for checking scripts, browser compatibility, and general site flow. SVS not only makes a development environment like this possible, it adds a level of coolness your LAMP buddies can only imagine.

Most Web developers have their development machine set up to do this using AMPP or Apache, MySQL, PHP and Perl. But setting up AMPP can be a pain sometimes, especially if you want full control over the install that the pre-built packages don't always offer. There are also times when you have access to your scripts but not to your test environment so your choices are a) installing everything onto a machine where you are or b) just working without the ability to test. I've personally had this dilemma pop up more times then I'd like, which is where SVS comes in.

All the programs in AMPP are open source so I can just carry VSAs of them around in my thumb drive with the Web sites as well as SVS to install on a computer. It cuts down the time needed to set up AMPP exponentially. Best of all, you can remove the layers and SVS in a matter of seconds and you don't have to worry what Apache, Perl or anything else left behind -- -pretty cool way to show the owner of the machine you're using how cool SVS is.

This is also a good chance to show how someone might set up an environment such as AMPP in SVS, where multiple programs interact with each other as well as excludes and data layers. Here's a list of all the layers I've included:

Program layers:

  • Apache Server 2.0.59
  • MySQL 5.0.27
  • PHP 4.4.6
  • PHP 5.2.1
  • PHPMyAdmin 2.10.01 (though this could also be a datalayer I guess)
  • Python 2.5

Data Layers

  • databases (captures the folder \MySQL\MySQL Server 5.0
  • htdocs (captures the folder \Apache Group\Apache2\htdocs)

Setup

All of these programs are using the defaults that are provided by their various vendors (so PHP 4 and 5 are using PHP.ini-recommended) so you can easily go in and make changes.

MySQL is also set to the default and has no password assigned to it (figured that would be easier then using root in this instance). All the programs are installed in the default directory paths (so c:\PHP, Program Files\Apache Group, etc). I could have easily set up PHP 4 and 5 to run at the same time under Apache (and is something anyone can still do if they wish) but I set them up as separate "versions" where only one can be active at the same time to demonstrate how SVS handles situations where you do have different versions installed on the same system. To do this I placed Apache's http.conf file in the PHP layers. Both PHP 4 and 5 have their own http.conf that points back to them and the required DLLs. They also place their DLLs needed for running in the Windows system32 directory instead of using the Path variable due to how earlier versions of SVS handles the Path (it works for the next release but not for the current release or beta).

The datalayers are set up to capture anything placed in their folders. For databases it's \MySQL\MySQL Server 5.0. The MySQL layer has an exclude entry for that same folder so when any new data is generated it's captured in the data layer (if active). I have a test database named datalayer to demonstrate this though the regular default databases that come with MySQL are in the MySQL layer from the install. This is easy to change but any changes made to them will go to the datalayer.

The second datalayer is htdocs which is the name of the folder that Apache uses for its Web services (or localhost in this case) and its set to capture anything saved in that folder.

Lastly is phpMyAdmin which is a PHP-based program for managing databases. While this can easily be installed in a datalayer because it's just text files that PHP processes and not a compiled program that needs access to the registry, I installed it as a program to show it can be done this way as well.

Click to view.

If you want to see more about how datalayers work and how to set up excludes for them you can read Scott's great article, An Example Config for Excludes and Data Layers.

Usage

Since these programs are virtualized in SVS they run as they would if they were installed to the base with one exception, one of the PHP layers needs to be active before Apache is started since the PHP layers contain Apache's config file and it can't run without it. I would set all the layers but Apache to auto-activate then manually start that one, or if you want to mess with layer priorities you can set PHP to activate before Apache and that should work as well. To switch between PHP versions you will need to stop and start (or restart) the Apache service since you need to reload the config file that the new PHP version contains.

Known Issues

Unfortunately at this time PHP 5 does not work with MySQL. I have not been able to figure out the reason why, so if anyone has any ideas, post them in the comments section and I'll fix it. Also, for Python and Perl, their Apache mod files are not installed. I'm not really sure this is a problem since for a test machine you really don't need it because the scripts will still run. It's something to note just in case.

License: Altiris EULA
By downloading this software, you agree to the terms and conditions in the Altiris End User License Agreement
Support: User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.
4
Average: 4 (9 votes)

This was accidentally left

Jordan's picture

This was accidentally left out of the article but VAMPP was captured using SVS 2.1 (beta).

It has not been tested on SVS SP1 (build 1407).

I tested it on XP SP2 and Vista -- didn't feel the need to test it on Windows 2000 but I'm sure it will work.

Vampp versus Xampp

erikw's picture

Jordan,

I use Xampp, and use it completely virtualised with SvS for over 4 months. Actually i have a copy of the www.svs4u.nl website in it, and it is great for testing.
Xampp is able to use PHP5 with Mysql. So it is not a php or mysql problem. The problem you encountered in Vampp with PHP5 is a Vampp problem.

And then one problem showed up.
Using Xampp as your web center, there is a directory created in the root of the disk where you installed it. After deactivating the Xampp module, the directory stays. This is noticed in the SvS 2.0 version. In 2.1 Beta 1.5 and 1.6 this does not appear.

regards
erik

xampp can be virtualized

Jordan's picture

I know xampp can be virtualized, I've tried it, but I wanted to make something that was more true to a typical setup. This was just something I did in my free time for personal use and thought others here might find it useful.

Xampp is nice but in every situation I've seen, people and companies tend to have their own Ampp running with what they need and not from a package and I think you get more control over the setup and configuration via single installs over a packaged install with a manager like Xampp.

Plus Vampp is a much better way to show off SVS than using Xampp because people can see how the layers interact.

And I know the PHP 5 issue is with my setup, as far as I can tell I've configured the ini files correctly but it still won't work.

Great Tip

jjesse's picture

Great tip and article on this. Can't wait to try this out on my VM.

Thanks

Thanks to Jordan for your

Thanks to Jordan for your article, I will try for sure.

Regards

Archive coming up corrupted

For some reason I cannot download the zip file. Shows up at about 42MB, and appears to DL just fine, but I cannot extract the zip file.

New Archive File

Juicemaster's picture

Thanks rmholden,

New archive file uploaded and tested ;)

JM

Thanks!

There's the 176mb we all know and love! Guess I'll go make some coffee, it's going to be a while over wireless...

Heres something that might help Downloaders

With files this large, an app called Gigaget is really great if files are mirrored on heaps of sites, then the downloader can access them all and pump them down at significant speeds.
e.g. a usual 20 kbs on my wireless often translates to 200 kbs from 10 sources.

As to the article, thank you, thank you, thank you.

Now maybe I can actually learn to test my work within an actual test environment.

Ya for a large file,

Jordan's picture

Ya for a large file, especially over wireless, I'd get some type of download manager that can download multiple threads at once (so downloads complete faster) and can resume downloads from where you lost your connection.

Using a test environment is great because you can quickly access the changes (not having to upload them, wait for the FTP server, etc.) on dynamic pages like PHP. The only hard part is trying to mimic your client's hosting set-up which isn't a huge problem unless they've got a really weird, custom setup.

PHP - Apache start issue

Does anyone know of a way, for a scenario like this, to have the layers activate in sequence? To detect the state of the previous layer before activating?

Usage

Since these programs are virtualized in SVS they run as they would if they were installed to the base with one exception, one of the PHP layers needs to be active before Apache is started since the PHP layers contain Apache's config file and it can't run without it.

PHP activation

erikw's picture

The config file for PHP is not actually in the PHP layer. It should be in the services layer.

The only way at this moment is to create one layer.

Best practice for virtualising Vampp or Xampp is to build one layer. When the layer is completed, deactivate it, and take the root folder out. The root folder should be called vampp or xampp.

Copy it to the root, outside the layer.
Then activate your layer. It then does not matter which layer is activated instantly when you run the server because all the config files are always activated.

This is the way I did it, and it works out very well.

Regards
erik

You can use SVScomand to

Jordan's picture

You can use SVScomand to set a layer's priority, just follow the SVS documentation on doing this.

"The config file for PHP is not actually in the PHP layer. It should be in the services layer."

I did it differently since I was using two PHP versions and was setting it up a certain way, I'm not quite sure what you mean by root though? Haven't delved much into Xampp buy a standard Ampp install has no root folder, you could take the Apache folder out and make that its own layer but you also need to remember to snag the PHP DLLs from the System32 directory as well. If you forget those (or use pathing) you won't be able to import the layer to a new machine.

Current Versions of SVS do not support capturing the path environment, though the next beta will.

About these interesting

About these interesting layers, do you have some plan to update or release a new VAMPP layer collection ?

Thanks
PM

Possibly. If I was to

Jordan's picture

Possibly. If I was to release a new version it would use path environments which will make things a little cleaner, problem with that is right now only the beta 2 supports this so I have to wait until more people have access to it (which will mean after the beta is over and the official release is out). I'd probably also try to get PHP5 working with MySQL as well.

Outside of that I'm not really sure what needs updating or redone, it works as intended, and outside of Ruby it's got everything else you'd want to use in a PHP setting. But if you've got anything in particular you're intrested in let me know and I'll look into it.

Syndicate content