Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kitki83

macrumors 6502a
Original poster
Mar 31, 2004
804
0
Los Angeles
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?

PHP:
<!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?
 
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.
 
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.
 
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.
 
What I usually do this use the "Reset to Apache/MySQL default"-button under Preferences -> Ports. hello localhost :)
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.