Jump to content

MAMP and PHP


Perakp

Recommended Posts

I downloaded MAMP the other day, which means Apache, MySQL and PHP for Mac. I read that macs have php support installed by default and an apache server built in, so I wonder if I could've just downloaded MySQL...

Anyways, there is this folder called MAMP/htdocs/ where I'm supposed to put my .php files, and then they'd be visible from http://localhost:8888, but so far none of my copy-pasted php hello world's haven't worked. I'm pretty sure my code is flawless, as it's straight from tutorials. Also I managed to run the code using mac's command line, aka terminal, with the command "php helloWorld.php". Been trying to figure out if the problem is with MAMP; did I install it wrong or is there something wrong with the apache server or what. I was hoping this to be more like the "install and you're ready" kind of package they promised it would be.

But if there are any php gurus out there, any words of courage would be appreciated.

Link to comment
Share on other sites

Plain html works fine

 

Running phpinfo();, I got hundreds of rows of information. Most peculiar lines were

 

Configuration File (php.ini) Path => /etc

Loaded Configuration File => (none)

 

but most of the stuff seemed to be enabled and working.

Oh, and phpinfo didn't work with browser, I did it with terminal to get the results.

Link to comment
Share on other sites

  • 3 months later...

Hmm. This might help.

 

Make a new file in TextWrangler or Komodo, or whatever, and add the folllowing code:

 

AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm

 

You're going to save the file as .htaccess (with the dot in the front; this is the file name).

Save it in /Applications/MAMP/htdocs. It will be an invisible file; you will not see it in Finder, tho you can if you cd to it w/ terminal, or searching w/in Finder and choosing the visibility type under Kind.

 

Now try going to http://localhost:8888/ and you should see all of the available files there. And with this newly created .htaccess file, you can now embed php inside an html file too.

 

 

 

 

I downloaded MAMP the other day, which means Apache, MySQL and PHP for Mac. I read that macs have php support installed by default and an apache server built in, so I wonder if I could've just downloaded MySQL...

Anyways, there is this folder called MAMP/htdocs/ where I'm supposed to put my .php files, and then they'd be visible from http://localhost:8888, but so far none of my copy-pasted php hello world's haven't worked. I'm pretty sure my code is flawless, as it's straight from tutorials. Also I managed to run the code using mac's command line, aka terminal, with the command "php helloWorld.php". Been trying to figure out if the problem is with MAMP; did I install it wrong or is there something wrong with the apache server or what. I was hoping this to be more like the "install and you're ready" kind of package they promised it would be.

But if there are any php gurus out there, any words of courage would be appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.