Nov
11
2008
2

How to setup a free web development environment (mac)

It may seem like a lot, and when something doesn’t work, you feel violently pissed off. But, it feels SO good when it works.

1: Get apache to work.

Update your version of mac os and go into system preferences. That’s the thing with the gears - very important to your mac. Click Sharing under internet & Network. Now in that list of crap on the side, check Web Sharing. Do whatever seems right and when you’re done, go to your web browser and type in whatever they tell you to. And, yes, if your friend, who is using the same router as you, types http://192.168.something into their browser they will get your site. Pretty awesome huh. Wanna change it?

2: Changing your website, OMG html

Use your finder to open your folder (the one with your name on it) and then the folder called Sites. See that thing called index.html? That’s what’s you’re seeing when you go visit the web address. First rename it to index2.html or something. Now to edit it, you can do it in texteditor but please act like a pro and download a program specifically designed for it like Aquamacs. Now, simply open the file with aquamacs (right click and go under open with > *kangaroo deer thing* ). A lot of code to read and learn from if you want. Open a new file with aquamacs. Copy this:

<html>
<body>
<h1>WOOT!!!</h1>
</body>
</html>

Save as index.html in the folder Sites. Goto your site now. The one that has ~yourname in it. WOOT!!! Play around with it. Call yourself god. Whatever.

Just know that it’s not real programming until you get Php.

3: Php

I mentioned somewhere that I liked Php. You should too.

There’s a few ways to enable Php. Notice I said enable, not install (go macs). Here’s the cool kid’s way:

Open up Terminal. It’s under Applications>Utilities. Time to learn a bit of unix. Even if you don’t know what the hell’s going on, it’s really cool. By the way, the thing you’re in right now is called the Shell. Go to the folder you need to modify by typing in:

cd /private/etc/apache2/

First, you need to change php.ini.default into php.ini with this command:

sudo cp php.ini.default php.ini

Next, you need to modify httpd.conf so type:

sudo vi httpd.conf

Type in your computer login password (blank if there is none). Now type:

/php

This searches the text for the words php and you should get something like

#LoadModule php5_module        libexec/apache2/libphp5.so

Type (not copy):

aandy rules

Pressing a lets you edit the file. Now delete andy rules since it is not relevant. What you do need to do however, is delete the # (the numsign) in front of LoadModule…

Now Type:

esc

:wq!

Finally, in your shell, what you should be in right now, type

sudo apachectl graceful

That restarts apache so you have your php install online. It’s apachectl with a l for long by the way.

Now, go to Sites (don’t tell me you forgot how) again and rename index.html to index3.html. Open a new file in aquamacs and copy in:

<html>
<body>
<a href=”http://www.Internshipin.com”>Internshipin.com</a>
</body>
</html>

<?php echo “Rules!!!”;?>

<? phpinfo();?>

Almost done ><. Save in Sites as index.php and check your site again!

4: Mysql

This one’s pretty easy. Go here and download the mysql that matches your mac OS version. Click on the mac icon on the top left to find your OS version. Download and open the readme. Follow directions and install everything.

5: PhpMyAdmin

This thing’s really cool. Go here, download and extract it. Rename the entire folder into something simple like pma or phpmyadmin. Just get rid of the version number and stuff. Now, apparently, this phpmyadmin is not complete. Really stupid, I know. Open up a new file in aquamacs and name it config.inc.php. Save it in pma or whatever you renamed your phpmyadmin folder to be. It should contain:

<?php $cfg['blowfish_secret'] = ‘ae85mh04wq23′; // Enter a random string to be used for blowfish encryption
// Server(s) configuration
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = ‘127.0.0.1′; // ‘localhost’ did NOT work!
$cfg['Servers'][$i]['connect_type'] = ’socket’; // ‘tcp’ did NOT work!
$cfg['Servers'][$i]['auth_type'] = ‘cookie’; // Using cookies is easiest and safest setup.
$cfg['Servers'][$i]['user'] = ”; // MySQL user - empty for cookies
$cfg['Servers'][$i]['password'] = ”; // MySQL password - empty for cookies?>

Move your folder to Macintosh>library>webserver>documents.

Reload apache again and now, when you goto http://localhost/pma, you should be able to see your phpmyadmin! Login as root with no password and make a user for yourself by going under priviledges.

My laundry’s done.

Written by Andy in: Knowledge, tutorial | Tags: , ,

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes