I was looking for a simple tutorial that described how to use MAMP and Coda together for locally developing CMS (php based) systems before making them live, in this instance Cubecart. I searched high and low and couldn’t find anything on the net specific to Cubecart. The best documentation I found was this blog post by Jay Robinson that explained how to setup Coda to work with MAMP for developing WordPress sites.
However, this tutorial describes how to set up MAMP to enable you to develop a Cubecart based site, locally, with Coda.
Credit where it is due: I had particular problems getting Ioncube for PHP working with MAMP. The following forum post was very helpful in setting that part up: http://forum.mamp.info/viewtopic.php?f=2&t=6875&start=0
1. Download and install MAMP
2. Download and extract Ioncube. (choose the relevant Ioncube download for your processor). You need to extract the file ‘ioncube_loader_dar_5.2.so’ into the ‘Applications/MAMP/bin/php5/zend/lib/’ folder
3. Browse to Applications/MAMP/conf/php5/ and open the file ‘php.ini’ in Coda
4. Add the following line at line 1085:
Be sure to add it at the correct line. When in places you should see lines above and below like this:
[cc lang=”php”]; Local Variables:
; tab-width: 4
5. Download Cubecart. Extract the contents to the local folder you want to use. For example, I extracted it into a folder on my desktop e.g. ‘Desktop/benfrain.com/clients/clientname/’
6. Start MAMP (Applications > Mamp. Click ‘Stop Servers’.
7. In MAMP, click ‘Preferences…’, choose the ‘Apache’ tab and enter the local folder address you are keeping your files in (same as the ‘Local Root’ field in Coda – we’ll get this in Step 9). Click ‘OK’ and click ‘Start Servers’.
8. Still in MAMP, click the ‘Open Start Page’ button. The start page will open in your default web browser. Click the phpMyAdmin link (under the MySQL header).
9. We now need to create a database for use with Cubecart. Enter a name in the ‘Create new database’ field. E.g. ‘cubecart_test’, ensure ‘Collation’ is selected from the drop down and that ‘utf8_general_ci’ is selected in the drop-down below and click ‘Create’. Now click the ‘Privileges’ tab.
10. Either amend the user and password of ‘root’ (the default user for SQL databases in localhost) to your preference or create a new user by clicking the ‘Add a new User’ link. Either way, make a note of the username and password and ensure the user has ‘ALL PRIVILEGES’ set. You can now close this browser window.
11. Now open up Coda and select ‘Sites > Add site’
12. Name your site. Enter ‘http://localhost:8888/’ in the Root URL and Local URL boxes, leave ‘Remote Root’ blank and in the ‘Local Root’ box enter the location of the folder you are keeping your local copy of the site at. Click the ‘Set…’ button and browse to it. You don’t need to enter anything in the ‘Connecting’ section for local development. Here’s what it looked like on mine (click for full size version):
13. Now two options to set-up Cubecart. Either open the site in Coda, (open the index.php page in your local folder and click Preview in Coda) and it should kick the setup process off.
14. Everything should be straightforward now, when it gets to the database details, you will need to user the database details from step 10.
15. After setup completes it is possible that you will be unable to access the Admin panel. To rectify this you may have to email Cubecart support and ask them to add ‘localhost’ to your licence.
That’s it, Cubecart is setup locally and you can do all your development work locally before uploading your amendments to a live site.