Saturday, November 17, 2007

"Linux-Apache-mySQL-PHP" (LAMP) environment

Ran across a great tool called 'xampp' for a development environment for PHP/mySQL (or 'Linux-Apache-mySQL-PHP (/Python/Perl/p?)' LAMP environment. I'll let the site share the details... http://www.apachefriends.org/en/xampp.html, but for myself, as someone comfortable primarily with Windows and .net, it was the easiest way I've seen so far to get this environment up and running.

The app is downloaded and extracted to a directory (no actual install, just lives within a folder). You then run an executable in this folder which gives you a control panel of sorts, almost like a trimmed down version of the 'Services' console in Windows allowing the 4 components to be installed, started, and stopped. It also indicates whether the service is running. The 4 services are Apache, mySQL, FileZilla (which is a FTP server, I've used the client version, but not server), and Mercury (not sure yet what this is)

mySQL started right away
Apache did not start right off the bat, but a few searches through the documentation showed a likely cause that it was colliding with an existing web server. In my case, IIS. Options are to shut down IIS and swap back and forth between the two, or change the default port for one of them. I changed Apache to use port 8080 by editing \apache\conf\httpd.conf (the 'control panel' for Xampp still shows port 80 for some reason), and voilĂ . PHP/mySQL apps are working. It includes PEAR for database access with PHP, but the few projects I've tried are direct to mySQL variety, so haven't had a chance to test...

As a bonus, it was able to be setup on an external drive, completely self-contained... The environment should be able to run from other machines with no changes...

For a few years now, my main laptop been running PHP and mySQL (which took some work to get up and running, and has never been upgraded for fear of 'breaking' what barely got setup working in the first place). Essentially, the Windows-IIS-mySQL-PHP (WIMP) setup. Used extremely rarely, as I maintained 3 or 4 web sites, such as http://www.menssana.org, or http://dvinterventioncenter.org. But most were using CMS's or other types of pre-built packages, so most of the editing took place on the server. There was just limited need to work locally. But at the same time, I relish being able to work on, refer to, or demo a project in a pinch without requiring an internet connection.

Started out looking for a virtual machine, with the intent of either rebuilding my WIMP box within a VM, or getting a prebuilt Linux vm. Found http://virtualappliances.net/products/lamp.php, which I might still end up using for some tasks. But for a Windows person like myself.. I just can't get around in the environment fast enough. Ran across xampp while looking at www.portableapps.com (side note - interesting that it is the first site that shows up when googling for 'portable' http://www.google.com/search?hl=en&q=portable&btnG=Google+Search) because there are tools like Portable FileZilla and Portable Notepad++. I figured I would place on whatever I ended up using for php/mysql development. Xampp is not part of the official portableapps framework, but seems to meet the same standard of being self-contained and running from an external drive.

No comments: