This guide assumes you are using a Mac. I did all testing on Mavericks.
Step 1: Download and install MAMP (http://www.mamp.info/en/index.html)
Step 2: Configure MAMP
Browse to Applications -> MAMP and click on MAMP. In the MAMP window click on Preferences and click on the Start/Stop tab. Make sure both Start and Stop are checked and uncheck the check for pro flag. The open at start is up to you. Leave the ports page alone unless you want to configure that yourself. PHP should be running 5.5.3, 5.2.17 seems to have problems with the JSON. Apache, leave alone. Hit OK to close the preferences tab.
At this point start your servers if they are not already green.
Step 3: Disable Caching
PHP 5.5 has some caching enabled which really caused some pain in testing. I would make a change and it would take awhile before it was enabled. You'll need to browse to /Applications/MAMP/bin/php/php5.5.3/conf/php.ini and comment out the OPcache section. It should be at the bottom. You want to put a ; in front of every line in that section.
Step 4: Create and Configure MySQL Databases
Browse to http://localhost:8888/MAMP/ and click on the phpMyAdmin link in the top bar. This will bring you to phpMyAdmin, a web management area for MySQL. It's very powerful, but since we are running MAMP, if you break something you can just reinstall. This is all based on the test project, but if you are using your own data, you want to make sure the tables match what you have in GS.
To start, click on the Databases tab. In the text box type in a tame and hit create. I'm using asyncTest.
![image]()
After it's created click on the database in the list below. This will allow you to create a table. You can create as many as you want, but for this test we only need one. Give it 3 columns and hit GO. I called mine testData.
![image]()
Now we have to create the columns. the names should match what you have in GS for ease of use, but it doesn't have to. The type needs to match exactly. I'm dealing with two columns of text and one integer. Hit save when you are complete
![image]()
We are now done with the MySQL Configuration. Let's move over to PHP.
Step 5: Configure PHP
We are going to be copying the template PHP file into /Applications/MAMP/bin/mamp/. I have it called asyncTest.php, but you can call it anything you want, even index.php. Before you go any further, we need to talk about security. This script is wide open, the default MySQL username and password are written in plain text and stored right in the file. When you push this to production you will NEED to secure this up. There are many methods of doing this, so I'll leave it up to you. I will be attaching the script in a separate post below.
Step 6: Configure the Test app
I will be posting my test app in a separate post as well, but at this point we need to configure it. If you are testing this locally and didn't deviate anything from above, you don't have to do anything. If you are testing remotely you will have to alter the URL attributes. I have two URL attributes in the app, a sendURL and receiveURL. My script handles both POST and GET so they both point to the same script.
At this point, the app should be fully functioning. Pretty simple huh? When you execute the script you must first click on the CONNECT button. This initializes the network features, but i hear in the future this will not be required. After that, hit the send button. When you see the send status turn green, your data has reached the server. At this point if you browse to the location of asyncText.php you will see a json.txt file. This is the output of the network call. You will need this later when you customize this for your data.
If you want to insert some records into the table manually do it now. Click on the database name in the left column, then again on the table name. Click on the Insert tab and input some values and hit GO. Do this 2 or 3 times.
![image]()
Now go back and hit GET in the app, you should see the next three values populate in the game.
That's it! I will be posting the php script and test app next, they deserve their own post.
Step 1: Download and install MAMP (http://www.mamp.info/en/index.html)
Step 2: Configure MAMP
Browse to Applications -> MAMP and click on MAMP. In the MAMP window click on Preferences and click on the Start/Stop tab. Make sure both Start and Stop are checked and uncheck the check for pro flag. The open at start is up to you. Leave the ports page alone unless you want to configure that yourself. PHP should be running 5.5.3, 5.2.17 seems to have problems with the JSON. Apache, leave alone. Hit OK to close the preferences tab.
At this point start your servers if they are not already green.
Step 3: Disable Caching
PHP 5.5 has some caching enabled which really caused some pain in testing. I would make a change and it would take awhile before it was enabled. You'll need to browse to /Applications/MAMP/bin/php/php5.5.3/conf/php.ini and comment out the OPcache section. It should be at the bottom. You want to put a ; in front of every line in that section.
Step 4: Create and Configure MySQL Databases
Browse to http://localhost:8888/MAMP/ and click on the phpMyAdmin link in the top bar. This will bring you to phpMyAdmin, a web management area for MySQL. It's very powerful, but since we are running MAMP, if you break something you can just reinstall. This is all based on the test project, but if you are using your own data, you want to make sure the tables match what you have in GS.
To start, click on the Databases tab. In the text box type in a tame and hit create. I'm using asyncTest.

After it's created click on the database in the list below. This will allow you to create a table. You can create as many as you want, but for this test we only need one. Give it 3 columns and hit GO. I called mine testData.

Now we have to create the columns. the names should match what you have in GS for ease of use, but it doesn't have to. The type needs to match exactly. I'm dealing with two columns of text and one integer. Hit save when you are complete

We are now done with the MySQL Configuration. Let's move over to PHP.
Step 5: Configure PHP
We are going to be copying the template PHP file into /Applications/MAMP/bin/mamp/. I have it called asyncTest.php, but you can call it anything you want, even index.php. Before you go any further, we need to talk about security. This script is wide open, the default MySQL username and password are written in plain text and stored right in the file. When you push this to production you will NEED to secure this up. There are many methods of doing this, so I'll leave it up to you. I will be attaching the script in a separate post below.
Step 6: Configure the Test app
I will be posting my test app in a separate post as well, but at this point we need to configure it. If you are testing this locally and didn't deviate anything from above, you don't have to do anything. If you are testing remotely you will have to alter the URL attributes. I have two URL attributes in the app, a sendURL and receiveURL. My script handles both POST and GET so they both point to the same script.
At this point, the app should be fully functioning. Pretty simple huh? When you execute the script you must first click on the CONNECT button. This initializes the network features, but i hear in the future this will not be required. After that, hit the send button. When you see the send status turn green, your data has reached the server. At this point if you browse to the location of asyncText.php you will see a json.txt file. This is the output of the network call. You will need this later when you customize this for your data.
If you want to insert some records into the table manually do it now. Click on the database name in the left column, then again on the table name. Click on the Insert tab and input some values and hit GO. Do this 2 or 3 times.

Now go back and hit GET in the app, you should see the next three values populate in the game.
That's it! I will be posting the php script and test app next, they deserve their own post.