MAMP without MAMP

Tuesday, February 10, 2009 21:06

phpmyadmin

As both an OSX user and a Linux developer find a localised LAMP installation somewhat useful. There are a couple of methods to achieve this, the quick way, and the *real* way.

The first method is to simply download and install the MAMP bundle. This comes as a self contained single package which runs completely from it’s own folder with *one click* stop and start (see the header image) , it’s free, it uses it’s own version of Apache and removal is as easy as just deleting the folder. MAMP is quick and stable and it couldn’t be simpler to install, it’s ideal as a quick test platform for your dynamic websites and php scripting however if your drop is more toward the actual ‘LAMP-ness’ of LAMP development you may prefer to install the real deal using a more professional approach, if so here’s the How To.

Apache

OSX comes with it Apache2 installed so it just needs enabling. Very simple, in System Preferences look for the ‘sharing‘ tab and just click ‘Web Sharing‘, that’s it, remember this as you’ll need to use it for restarting Apache later.

Php

Leopard comes with php however it’s a basic version and doesn’t have all the goodies needed for full MySQL functionality, as such it’s recommended to use the excellent entropy packaged installation from Marc Liyanage. Download from HERE, click and install.

To test php create a text file containing the following single line..

<?php phpinfo(); ?>

..save it as test.php in your /’username’/sites directory, re-start the webserver (web sharing) through system prefs and go to http://localhost/test.php, you should see an extensive list of resplendent php goodness

MySQL

I presently find version 5.0.82 works best with phpMyAdmin under OSX as oppose to the newer 5.1 release, download it (HERE) and install the main package, the startup item & the preference pane, it’s all quite straightforward. Once done it just needs a touch of fine tuning, open up terminal again and type the following (entering user-name & password when requested)..

cd /usr/local/mysql

sudo chown -R mysql data/

..start the service through the newly installed utility under System Preferences and in Terminal type the following (this is to secure the DB and set a password)..

sudo mysql_secure_installation

..quite self explanatory, and it will prevent a nasty #1045 DB access error when firing up phpMyAdmin for the first time.

PhpMyAdmin

To install firstly download the latest stable release from HERE, click to expand, rename the folder to just ‘phpmyadmin’ and move it to the sites directory alongside the test.php file you created earlier.

Inside the phpmyadmin folder locate the config.sample.inc.php file, open it in a text editor, at the top of the file you’ll see the following line..

$cfg['blowfish_secret'] = ”; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

..input a string of letters and numbers (of your own choice) as follows and re-save as config.inc.php

$cfg['blowfish_secret'] = ‘insert1234567′; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Restart Apache again and that should be it, log in at http://localhost/phpmyadmin with ‘root‘ + the password you created earlier.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

You can leave a response, or trackback from your own site.

8 Responses to “MAMP without MAMP”

  1. Phil says:

    February 11th, 2009 at 2:59 am

    Can you run that by me again?

    Seriously though – for the hard of thinking amongst us, can you just shed a bit of light (in layman’s terms please) on what you use all this stuff for? Why do you need it? What does it do? How does it work?

    I don’t get it.

  2. richbos says:

    February 11th, 2009 at 8:08 am

    The LAMP stack, sure man, our systems ( http://www.jingsoftware.com ) presently run (predominantly) on the MS SQL platform through IIS, serving up ASP pages to the client, we’re migrating all database modules to the open source (MySQL > PHP) so’s customers can have a choice, plus there’s the cost factor.

    Having our own local development rig up aside from a web based system is incredibly useful on many levels and being LAMP savvy is also a good egg of technical knowledge to have as 3/4′s of the worlds web servers run various flavours of open source (Linux).
    PhpMyAdmin is merely the Admin GUI for MySQL, you can do it all on the command line and although I do use bit’s and bobs in Terminal during the initial set up, for daily admin it’s obviously much easier.

    The WordPress and Joomla instances are useful as another section of the business involves eLance projects ( http://www.elance.com/ ), for example we’re presently developing our own WordPress templates & themes so having a local test bed for development (faffing..!) is again most useful. As for having such on the Air, as mentioned, on days I’m at the cabina (rather than the office where the Ubuntu LAMP box is) it means I can still *do*.

    All this all shows just how superb OSX is, aside from the i-*stuff* Apple’s operating system is an amazing tool for development on many levels, that Darwin UNIX base rocks, that’s what I like about the Macs, they’re marketed as uber cool trendy media units (which they are) but they also offer a rock solid technical development platform for the geekiest coder or systems guy. Job’s was a genius bringing it all over from NeXT – http://en.wikipedia.org/wiki/NeXT (Have you seen NeXTSTEP? Take a LOOK – recognise anything?)

    In a nutshell – LAMP is the *engine* the web runs on, I’m the mechanic :-)

  3. Jem says:

    June 9th, 2009 at 3:43 pm

    Hi…. thanks for this – I keep getting the #1045 error and a ‘Cannot load mcrypt extension’ error.
    I’ve managed to install libmcrypt ok I think, but have got a bit stuck after that… any ideas? I’m a relative newcomer to this level of Unix…
    Thanks,

    Jem.

  4. richbos says:

    June 9th, 2009 at 4:10 pm

    Hi, I’m just in the process of updating the procedure using the newer entropy package, I’ll post here with a relevant link to the new section when I’m done, you should get a notification to advise.

  5. richbos says:

    June 9th, 2009 at 8:51 pm

    @Jem – Above post updated, it’s a whole lot smoother and easier.

  6. Jem says:

    June 10th, 2009 at 7:56 am

    Thanks!! That worked beautifully….

    Jem.

  7. richbos says:

    June 10th, 2009 at 9:05 am

    Hey mate, Yes, it’s a bit easier than before now the entropy bundle is updated and out of BETA it’s much more stable and slicker to install, quite nice in fact.

    Glad I could help, however to be honest it needed updating anyway so thank YOU for commenting, it prompted me to get my arse in gear :-)

    I’m thinking about creating and dedicating a new section here solely to OSX-ey system bits and bobs (and maybe apps) to compliment the Linux & LAMP pages so maybe keep an eye out.

    Best regards

    Richard.

  8. Too Much Green » Wordpress on OSX says:

    September 7th, 2009 at 8:27 am

    [...] Firstly you need to install the server side of things (Apache, MySQL, php & phpMyAdmin), this is quite straightforward and I’ve a separate quick and easy ‘How To’ for that HERE. [...]

Leave a Reply

Spam protection by WP Captcha-Free