PDA

View Full Version : Guide to MAMP and setting up my own server




kitki83
Sep 22, 2008, 05:47 PM
I am taking a PHP course and the instructor recommended we try setting up a localhost but our textbook has different approach. We where instructed to use LAMP, WAMP or MAMP depending on our system.

I just installed MAMP and running but not sure how is the localhost setup suppose to be, can I just open php file having phpInfo(); and get results. So far FF3 just shows the Header html.

Can someone give me a guide to setting up and able to run my own local server?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hello in PHP</title>
</head>

<body>
<h1>Hello in PHP</h1>
<?
print "Hello, world!";
phpInfo();
?>

</body>
</html>



Aside from this is it possible to create Flash website using readfile(text.txt); for the content?



tominated
Sep 22, 2008, 06:22 PM
put all the files for the website in /Applications/MAMP/htdocs and you should be ready to go.

kitki83
Sep 22, 2008, 06:26 PM
put all the files for the website in /Applications/MAMP/htdocs and you should be ready to go.

That's where I saved the file as php at. Still will not showing the PHP portion. I am running MAMP while doing it.

angelwatt
Sep 22, 2008, 07:17 PM
That's where I saved the file as php at. Still will not showing the PHP portion. I am running MAMP while doing it.

Are you opening http://localhost/ ? As long as a index.php file is inside the htdocs folder that should do the trick. If it has a different name then type that in at the end. Also, just in case, make sure to open up the MAMP control panel and turn on the servers.

Poeben
Sep 22, 2008, 07:53 PM
1. MAMP runs on it's own port, 8888 by default. Keep that in mind in your urls.
2. Short php tags may be disabled by default in MAMP. I don't recall to be honest.

kitki83
Sep 22, 2008, 07:57 PM
1. MAMP runs on it's own port, 8888 by default. Keep that in mind in your urls.
2. Short php tags may be disabled by default in MAMP. I don't recall to be honest.

I figured it out for future reference what I did is click on home page of MAMP
which took me to
http://localhost:8888/MAMP/?language=English

I then saw the port number so that was my missing part
http://localhost:8888/hello.php

and loaded my site just as I wanted.

Thank you all for the tips and advice.

Volante
Sep 22, 2008, 08:28 PM
What I usually do this use the "Reset to Apache/MySQL default"-button under Preferences -> Ports. hello localhost :)

myjay610
Sep 25, 2008, 07:16 AM
Did you actually try running the MAMP application that comes with it? It lets you easily configure things like the port number, WWW root, etc. It should be in your applications folder.