Setting up a local web development environment
Setting up a local web development environment allows you to create and modify web applications on your own computer, rather than uploading the application files to a server to run the files.
To set up a local web development environment, you will need to download and set up a web server, such as Uniform Server, on your local machine. Uniform Server (similar to WampServer or XAMPP) simulates a web server on your machine with the LAMP Stack (Linux, Apache, MySQL, and PHP) resources, which are essential for working with Swarm Tester, Joomla and other applications.
In addition to a web server, there are a few other programs you'll need to work with application files. One is Notepad++, a text editor that lets you write and edit various types of code, including PHP. You will also need to install TortoiseSVN, a subversion client that will help you manage versions of source code. This article walks you through setup and installation of these web development resources.
Install Notepad ++
You will need to install or already have a text pad editor so that you can edit code. Notepad++ is a popular editor.
- Go to www.notepad-plus-plus.org.
- Click Download in the left sidebar.
- Click Notepad++vXXX Installer, where XXX refers to the latest version. For example, Notepad++v6.1.3 Installer.
- After the installer file downloads to your computer, click it to begin the installation.
- When prompted with User Access Control permission, click Yes.
- Select your language and click OK.
- Click Next through the menu, and then click Install.
TortoiseSVN is Subversion source control software that will allow you to download, upload, work on, and track changes in project files.
- Go to http://tortoisesvn.net/.
- Click the Downloads tab. (Note: Do not the Download button in the advertisement section).
- Download the correct version for your system (32-bit or 64-bit). If you don't know whether your computer is 32-bit or 64-bit, click your Windows Start button, right-click My Computer and select Properties. The System Type lists this information.
- Click the downloaded file to start the installation.
- Click Run.
- Click Next through the menu, and then click Install.
Set up a web server
Install a web server
Uniform Server is a local server that will allow you to test the applications you create or modify with or without the Internet. XAMPP or WAMP can also be used, but these instructions are for installing and using Uniform Server.
- In your web browser, go to www.uniformserver.com.
- Click /download in the upper-left corner.
- Click the link next to “Looking for the latest version?” to download Uniserver.
- Move the downloaded file to your C:/ drive. Note:Do not move the file to your Program Files folder as this will cause permissions problems later.
- Double-click the file to start the installation.
- When prompted, click Run.
- Click Extract when prompted.
Uniserver extracts and installs in its own self-contained folder called Uniserver. All installation files are contained in this folder (nothing is added to your registry).
If you run into trouble with installation, see the Uniform Server wiki section on installation.
Set up your web server
- Open the UniServer folder.
- Double-click Start_as_service. (You can drag this file to your taskbar for quicker access.)
- When prompted for permission by User Access Control, click Yes.
- When prompted to change your password, Click Yes.
- Type a new password in the text box.
- Click Change Password.
- Click OK to proceed and close the Set New MySQL Password dialog box.
In the Uniform Server dialog box, there are several new options.
- Click Install Apache Service.
- Click Install MySQL Service.
SOAP, or Simple Object Access Protocol, is a protocol that allows applications to exchange structured information over other web protocols, such as HTTP. Enabling SOAP is necessary when working with some applications, such as Swarm Tester.
- If it's not already open, start Uniform Server by navigating to the Uniserver folder (installed on your C:\ drive) and click Start_as_service.
- Click Server Configuration.
- In the new window, click PHP.
- Select Edit Current Configuration file: php.ini.
- In the new window, search (ctrl+f) for soap.
- On the line, ;extension=php_soap.dll remove the semicolon. This will uncomment the line and make it active in the code.
- Save and close the file.
- Close the Uniform Server Configuration window.
Testing the web server
- In the Server Service window, click Start Apache Service.
- Click Start MSQL Service.
- Click View www.<p>A new web page, “Welcome to The Uniform Server," opens.
- In a new Notepad++ document, type:
<?php phpinfo(); ?>
- Save the file as phpinfo.php in the C:/Uniserver/www folder.
- In your web browser type localhost/phpinfo.php
An information file should open on a new web page. If it does, you have set up your web server correctly and PHP is working.
Checking out project files
At this point you need to be a member of a developer project in order to access the project files. See 2. Join a project (volunteers) for more information on joining projects. Each project has various roles, such as project manager, tester, developer, and observer. The project manager sets roles for each team member. Although any team member can check out source files, you must be designated as a developer on the project to commit changes back to the source code repository.
To check out the project files:
- Go to tech.lds.org.
- Sign in with you LDS Account username and password.
- Click Projects and find the project you are working on.
- Click the project to open the Project Details.
- Copy the link by Source Code Repository
- Go back to the UniServer folder on your C:\ drive and open the www folder.
- Right-click and select SVN Checkout. Note: If you do not see this option, you have not installed TortoiseSVN.
- Under URL of Repository paste the link. (This field may be auto-filled from your clipboard already.)
- Click OK.
- Enter your LDS Account username and password.
- Click the check box titled Save authentication.
- Click OK. This will add a folder to your www folder and download a copy of all the relevant project files to your machine.
- When checkout is finished, click OK.
There is now a folder with the name of your project containing all the development files for that project.
Working with TortoiseSVN
There are several features of TortoiseSVN that will allow you to easily track and change files. You can see which files were changed and exactly where they were changed. You can also create patches so that an administrator can easily check and apply the changes that were made.
See the changes made to a file
When you make changes to a code file, such as a read-me file, a red dot will appear next to the file and folder where changes were made. For practice, once you've downloaded project files, such as from the LDSTech project, navigate to a Read Me file (if one exists, such as in the ldstech > wiki > trunk folder for the LDSTech project) and make a change. To see the changes made:
- Right-click a file with a red dot.
- Go to TortoiseSVN > Diff.
A side-by-side window appears highlighting the specific place where changes were made.
See the changes made within a folder
In the project folder, a red dot will be present to signify that a change was made to a file within that folder. To see the changes made in the folder:
- Right-click the folder with the red dot.
- Go to TortoiseSVN > Check for Modifications <p>A window appears listing all the files that were changed.
- Double-click the file name to open the side by side diff view.
Unless you are designated as a developer on the project, you will not be able to commit changes directly (by right-clicking the file and choosing SVN Commit), and any attempt will result in an error message.
Instead, when you have a fix, you will need to create a patch of the changes you made and then submit it to the project manager for approval.
Create a patch
A patch is a text file that contains code detailing the changes you made to the files. This will let the developers easily see and approve any changes you make. It will also let the developers easily apply your changes. To create a patch:
- Right-click the folder you want to create a patch for.
- Go to TortoiseSVN > Create Patch.
- In the window that appears, select the files you want to create patches for, and then click OK.
- Save the patch.
- Send the patch to the project manager or developer on the team.
Revert a file
Reverting will undo any changes that you made to a folder or file. It will revert the file back to the way it was before you opened it. To revert changes to a file:
- Right-click the file.
- Go to TortoiseSVN > Revert.
- Select the files you wish to revert, and then click OK.