Setup a Testing Server
History Key
- New content
Removed content
Recent Versions
Choose two versions to compare, or click the link to view it.
To reproduce an actual live production environment we need to setup or have access to a server. A server refers to a computer with software or the software itself that is "serving" content to another source, typically a web browser.
You can use the AMP software package to setup your server. On Windows I use XAMPP, on Mac I use MAMP and on Linux I use LAMP. These include the "Apache" server, "mySql" database and PHP extension as well as various additional components. Apache is the actual server software. MySQL is database software. And PHP is an extension to Apache to interprit and provide PHP webpages.
When Flash Builder compiles your project it publishes the files to a folder called, "bin-debug". This is the default output folder that's created when you created your Flex Project. Once your server is setup you will need to point it to this folder. The reason we do it this way is so that we don't hard code in the publish directory which could be different from machine to machine and operating system to operating system.
TODO:
The CleanMac upand Windows AMP packages both contain very easy installers. Download the installer from those sites and follow the prompts. Make sure the sectionsserver belowis running properly and then continue to the next section.
Changing the server document root folder on Mac
Open MAMP Control Panel. Go to Preferences and select the Apache tab. In the Document Root field browse to your new projects, "bin-debug" directory. Click OK.
Changing the server document root folder on Windows
Quoted from here,
By default, the Apache uses as the server root the "htdocs" folder located inside its installation folder. This is the folder in which you need to put the files that are going to be served by Apache. If you want to use another one, locate in httpd.conf (currently in C:\webroot\xampp\apache\conf) the DocumentRoot option and put the folder that you want to use as server's root (surrounded by double quotes). Then move a few lines below until you find the comment that reads "This [the following line] should be changed to whatever you set DocumentRoot to", and follow its advice. For example, if you want to change the server root to "D:\Web server" you have to use the following configuration lines:
DocumentRoot "D:/Web server"
and several lines below:
<Directory "D:/Web server">
Note that in the Windows version of Apache you can use slashes or backslashes indistinctly for path names, it would work the same (I use slashes since it's the usual way).
Finally, restart the server to apply the changes. The next time you access to "http://localhost/" you should see the contents of new root folder listed.
Pointing the project to test on localhost and not the file system
- After installing the appropriate software linked above, start your local web server.
- In Flash Builder, choose Project > Properties.
- Select the Flex Build Path screen. In the output folder, enter, "http://localhost" where the project name is the name of your project
If you are on a Mac and you are working with Windows users you can change your port to "80". If you don't you must use the default port 8888 to access your site, as in "http://localhost:8888/".
Changing the port in MAMP control panel
- Open MAMP Control Panel and enter the Preferences panel.
- Select the Port tab and change the port to 80 instead of 8888.
Now you can just type "http://localhost" instead of "http://localhost:8888" to access your server.
After setting up the local web server, when you test your projects in Flash Builder they will launch in the browser and run from the server (http://localhost) rather than the local file system (file://path/to/project/bin-debug/myproject.html).