If you current development model involves writing code (PHP, SQL, etc) in IDE such as Dreamweaver or Visual studio and then uploading to your webserver, then perhaps this way of developing your web applications should taken onboard. When developing applications locally and then uploading them, you get in cycle which heavily uses storage, bandwidth, as well as resources on your remote server such as databases.
By developing code locally, you get the same benefits but just with the added example of not using any resources on the server, or time having to upload and setup these. In our opinion you also get many security benefits due to not having to upload any code to your server until it is a finished live version ready for public consumption.
As a Microsoft Windows users, Linux and its associated servers can seem daunting ; for instance when you realise that Linux does NOT use file extensions like Windows, often it can feel like 'critical knowledge' has been taken away from you (and hidden). However, by running the L.A.M.P stack on your Windows desktop, often many of the strange attributes of Linux, have now been 'redesign' into the Windows UI guidelines, making a much more simple process for existing Windows users.
You will need most of the files below in order to setup your LAMP development environment for developing PHP and SQL scripts locally. Please note that the Java file required are just the Java run-time environment files (no other java).
XAMPP offers Linux Apache, MySQL and PHP. PHPEclipse is a PHP focused version of Eclipse. And the Java runtime environment is needed for all this applications to correctly work together.
1. Download and install the latest JDK, if you never ever plan to do Java development you can get by with just the JRE
2. Download PHPEclipse and unzip it to the eclipse directory, ex. c:\eclipse.
3. Download and install Xampplite, this is a zip also, treat it like eclipse and unzip it to the root of your c: or d: or whatever, the directory will be something like c:\xampplite.
4. Download and install MySQL Gui Tools, this is actually an installer, you can let it install to the default location with the default settings, especially if your lazy like me. This one could be considered optional if you just prefer to PHPMyEclipse that’s included with XAMPP.
5. Now setup your project in Eclipse
1. Open Eclipse, you may need to dig in to the c:\eclipse directory or wherever you unzipped it and create a shortcut of eclipse.exe. Choose a directory when prompted to store your workspace, I typically use c:\web, we’ll assume you did too, it’s important to remember where your workspace is for later configuration.
2. Go to Window -> Preferences -> PHPeclipse Web Development -> PHP External Tools -> XAMPP
3. Make sure the XAMPP Start and Stop lines point to where you unzipped XAMPP earlier 4. I just had to change the xampp directory to xampplite.5. Open the PHP Perspective by going to Window -> Open Perspective -> Other -> PHP
6. Right click in Navigator New PHP Project, give the project a name that makes sense, this is where your code is gonna go
7. You can leave Eclipse open, we’ll come back to it to set up your project.
1. UrlRewrite is disabled by default in XAMPPLite, if you’re going to use pretty url’s for your permalinks in wordpress or any type of SEO friendly urls that will involve rewriting you’ll need to enable it. To enable go to c:\xampplite\apache\conf\ and open httpd.conf with your favorite text editor, uncomment the line LoadModule rewrite_module modules/mod_rewrite.so by removing the # sign at the beginning of the line.
2. The next thing you’ll need to figure out for yourself is what you’re planning to use as the url to access your individual projects locally. I use a scheme like local with my site name, for example http://localgreatwebguy. You don’t have to do this, but I have more than one project and I only want to do this configuration thing once and focus on the more important things like writing code and xampp is gonna need it to get things straight and give you the flexibility you need.
3. Now that you’ve picked out your name you need to set up a host entry for it, in windows you’ll open the file c:\winnt\system32\drivers\etc\hosts with notepad (special note for Vista you’ll need to open notepad as an Administrator, to do this right click the Notepad in your program list and choose Run as administrator), depending on your installation some windows flavors may have their system32 folder in c:\windows, I’m sure you’ll find it. With the file open add an entry at end of 127.0.0.1 line, after a tab with the name you chose for your application ex. 127.0.0.1 localhost nweb.
4. Now we need to set up a virtual host in apache, open c:\xampplite\apache\conf\extra\httpd-vhosts.conf with your text editor again, there’s an example already in the file, we’re gonna modify it to look something like this:
Some things to note in the above VirtualHost configuration, the first virtual host is to keep the XAMPP console in tact. which offers PHPMySqlAdmin and some other tools. The second VirtualHost is the setup for your project, the ServerName and ServerAlias should match what you set up in your host file.
The DocumentRoot and the Directory should match where your project is stored by eclipse, which is a combination of the directory you chose as a workspace and the name you gave the project you created. You can also get away without specifying the ServerName and changing the Directory to just “/”, it works both ways I just rather be verbose about it.
You’re to the point where you can run XAMPP and you can start configuring MySQL and drop some code into this project. First things first, close everything but Eclipse, make sure you saved everything and you didn’t fat finger your VirtualHost configuration, host entry, or project name, it’s key that they match. Switch to the PHP Perspective, if you’re not already there in Eclipse Start up XAMPP with the icon in the top left of your Eclipse environment. You should be able to open a browser and go to http://localhost to see if XAMPP started properly.