Mac Apache MySQL PHP – MAMP

25 Comments

If you’re a developer, or maybe more specifically, an aspiring developer, you have got to check out MAMP.

Some of you may be familiar with LAMP, which was the Linux Apache MySQL PHP installer package. Well the incredibly cool folks at webEdition have blessed the mac faithful with the OS X installer package.

I downloaded and ran the package installer and it couldn’t have been simpler! Literally 2 minutes after running the installer, I had my entire environment up and running, logged in, and ready to get crazy with some php app development. Best part? Doesn’t touch the regular OS X Apache installation! Very cool.

You need to check it out if you’ve ever been interested in working with these kind of technologies. Then, once you’re comfortable with it (or ready to just trash it) just delete it and the whole installation is gone – all from one directory.

25 Comments

Brian

I have been trying for 2 days to get this working and sadly I still failing miserably. I don’t think MAMP is the problem, I have that installed and it all looks like its running happily, but I am just trying to test the file test.php:

but going to “http://localhost/test.php” leads to a page that says “Index of /” followed by a list starting with “Java/, PoweredByMacOSX.gif, WebObjects/, apache pb.png”

I have the file saved in htdocs. I am feeling hopelessly lost, any help will be appreciated.

jr

To view pages in MAMP’s document root folder (htdocs), your browser needs to be pointed to “http://localhost:8888/”. The 8888 port is the default port when MAMP is first installed (it can be changed in MAMP’s preferences, but I wouldn’t). If you point your browser to just “localhost” it will try to connect to the Mac’s built-in Apache server.

David

ln -s doesn’t work for MySQL WorkBench ;/ there is no custom socket path field anymore in advanced options too as in previous MySQL Tools.

nolan Nadesan

does MAMP interfere with previous installations of MySQL and Apache?
im running this on a MAC. os x 10.5

mediaguru @ Hooked On Golf Blog

This is incredible. I’ve been messing around with mysql and apache on my G5 for two days. Finally got it running, then I screwed up one file and brought the whole mysql system down. I’ve fried my brain for two days.

So in trying to debug and fix what I did, I found MAMP. In THREE mouse clicks I had an apache/mysql/php system running perfectly. I could have saved two DAYS if I found it sooner!

Jesse

Oops, I guess code is not allowed. I triple checked my code against the book, and I like I said, it works on a commercial server with the exact same configurations.

Jesse

Please help. I have MAMP installed and I am trying to run a basic php script using an include statement and it does not work. If I upload this code to a server (GoDaddy), it executes just fine.
Here is the entire output when the page loads:

Test Page

Hello, World.

Warning: include(includes/footer.php): failed to open stream: No such file or directory in /- on line 15 Warning: include(): Failed opening ‘includes/footer.php’ for inclusion (include_path=’.:’) in /- on line 15

Here is my code for this page:

Test Page

Test Page

 

I am a newbie to php, and trying to work through some basic tutorials. Any help would be greatly appreciated. Thanks in advance!!

jeremy wyss

you should check out the extension i got from peakstudios.com it did all the busy work for me and i knew it was done correctly.. when it comes to do data bases i am lets say a moron and this AS3 extension was my savior. it did everything for me!!

Fran Westley

Can anyone help? I an trying to run Moodle on an old OSX server machine (OS 10.2.8) and when I try to run MAMP is just quits on me. I thought maybe the version of MAMP is too high for the OS???? Any suggestions would be greatly appreciated.

Collin L

I have recently set up my MAMP DynDNS site. At first it was a little confusing, but finally i got me connected through to the internet so my friends could view the pages on my mac. But about…Oh say a week ago, I happened to take a look at the DynDNS Updater app I have (or I suppose had would work better) running in unison to MAMP. I could either connect via the ‘default (my ip address)’, or the ‘web-based IP Detection (my ip address)’ interface. Either one would connect my friends at different ip addresses to my site. Now, I get this error message saying, ‘HTTPS Error: peer certificate cannot be authenticated with known CA certificates.’
Any ideas?

Rick Squires

Hi

I’ve tried using MAMP with PHP pages generated using Rapidweaver(don’t know PHP so this seeemed a good place to start). I’m trying to use a very simple contact form, but I get the following error in the PHP logfile:

PHP Notice: Undefined variable: tmp_name in /Applications/MAMP/htdocs/Sites/MFL/page11/files/mailer.php on line 25

Line 25 in the .php file has absolutely nothing to do with this:

I downloaded MAMP a few days ago, so I guess I’m running the latest version on an Intel iMac (10.4.8 with all the latest security updates running)

I have tried both PHP 4 and 5 from the widget, with the same results

I’m probably missing something very simple, but any pointers would be much appreciated!

Help!

Kemp

The symlink fix mentioned above is temporary.

A symbolic link in /tmp is not persistent across reboots. One can:
1. Create the symbolic link at the command line immediately before starting Apache and MySQL:

$ ln -s /Applications/mampstack-5.5/mysql/tmp/mysql.sock mysql.sock
$ /Applications/mampstack-5.5/mampctl.sh start apache
$ /Applications/mampstack-5.5/mampctl.sh start mysql

or

2. create a startup script to recreate it. To do this you create a simple shell script to do it and then set it to run at startup by editing /etc/ttys (after saving the original version)
(see the following links: http://docs.info.apple.com/article.html?artnum=301446 http://www.bombich.com/mactips/loginhooks.html)

or

3. Go with the BitRock solution in their email for the time being until release 5.6 is out with a fix for this.

I have used each of these approaches and can confirm that they work. It is not a big deal in any case. Simply pick what you prefer and go with it.

Kemp

Kemp

I received a prompt response from BitRock as included below.

Kemp

Thank you for interest in MAMPStack, and inform us of this problem.
You need run the mysql programs adding the following option:

–socket=/Applications/mampstack-5.5/mysql/tmp/mysql.sock

For example:
/Applications/mampstack-5.5/mysql/bin/mysqladmin
–socket=/Applications/mampstack-5.5/mysql/tmp/mysql.sock -p version

This is currently wrong in our documentation, but we have fixed this for
the next release of MAMPStack.

Thanks!
Ana

BitRock Support
[email protected]

Kemp

Let me also mention that I use TinkerTool (avilable free at http://www.bresink.com/osx/TinkerTool.html) to make hidden directories and files appear in the Finder. When hunting for files this can be very handy, especially since SpotLight failed to find files like mysql.sock and I had to find them manually (one could also use Terminal to find them at the command line but I preferred the GUI). I just turn on the hidden files when I need to, and relaunch the Finder. I switch it back when I am done.

Kemp

Kemp

Though either MAMP or MAMPStack should be pretty equivalent, I downloaded and installed MAMPStack 5.5 since the versions were a tad newer and it had Python as well. It went smoothly with one important issue which I was able to resolve as detailed here.

After the install, the Apache test went fine. Starting MySQL went fine. But verifying that it was up with the following:

Prompt> /Applications/mampstack-5.5/mysql/bin/mysqladmin -p
version

Returned the following:

/Applications/mampstack-5.5/mysql/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)’
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!

The configuration was looking in /tmp for the MySQL socket, which actually was to be found in:
/Applications/mampstack-5.5/mysql/tmp/mysql.sock

I cd’d to the /tmp directory and created a symbolic link to the actual location of the file:

ln -s /Applications/mampstack-5.5/mysql/tmp/mysql.sock mysql.sock

That provided the key link and everything worked.

It is as though the programs in /mysql/bin/ are hard-coded to look in /tmp for mysql.sock. They must be configurable but I haven’t figured it out yet. In any case, the symbolic link fix is simple and works even if it’s a bit of kludge.

Perhaps this would not be an issue with MAMP. But I think I had to deal with a similar issue during the install of MySQL 4 so it may be a more general issue.

I hope this is useful.

Kemp

William Ryan

I am having a problem with superglobals using MAMP. None of my FORM variables are being passed over to the php script. What do I have to do with MAMP to get these variables to work?

I would appreciate any advice.

Donal

Thanks for all the help. The final solution was quite simple. Once I determined that the first installation was still running in the background I trashed it and restarted the computer. Everything back to Green Lights. Yeh!

Donal

kaliban

Oh, one more thing. In some cases, further researching or implementing a solution to the problem will best be done at the command line. This means launching the ‘Terminal’ application, opening a shell (terminal window), and begining to find your way around the linux/bsd back-end. If you find helpful hints from people using other linux like operating systems, and the directions they give you seem like command line instructions, you can try them out by opening a shell and typing them in. In that case, look for any linux introductory website to get oriented to the shell and the command line.

Good luck

-k

kaliban

Hi Donal,

Anytime you attempt to start a server engine such as mysql or apache, mamp or otherwise, there will typically be a log file recording errors that are encountered. Checking the log, in my experience, will nearly always point you in the direction of the specific problem that is causing the server not to start & stay running. The solution will often then be readily at hand, either by following your intuition and experimenting until the problem is solved, or by googling the error message or some portion of it, until you find the solution you’re looking for.

The MAMP 1.2.1 error logs for apache, mysql and php, are located in the MAMP folder, in a subfolder called ‘logs’. Open that folder and you’ll see the three relevant text files. In this case, open the mysql_error_log, and you’ll likely see a list of complaints for each time you’ve attempted to start mysql. Sometimes the list can be quite long, and it may seem to be very esoteric, but don’t let this put you off. Often times, one single problem will be reported over and over again throughout different stages of the server launch, or additional problems will be reported that are merely derived from the first problem. Fix the one problem, and many or all of the other errors are likely to go away.

Also, don’t worry about the fact that you might not understand much of the language reported in the error log. Just read over it line by line, grasping the parts you can and mentally setting aside the parts you don’t understand. Chances are, you’ll understand enough to locate the likely source of the problem. Do your research, try to restart the server, and check the bottom of the error log to see what has changed. Finally, the server will start right up and away you go.

If after all of this, you simply cannot find the solution, the best approach is usually to find a good related newsgroup, mailing list, or forum and post a summary of your question followed by the full details of your hardware, operating system & version, the software version you’re having trouble with, any solutions you’ve tried, and very importantly the full relevant portion of the log file(s). By supplying all of this detail, someone else will likely be able to understand your problem well enough to suggest a probably solution.

** Another important note: MAMP is a very cool packaged implementation of apache, mysql, and php, which works great right out of the box, but in order to achieve this level of simplicity, many of the related files, including log files, application files, conf files, etc., are located in non-standard places. This may have ramifications as you research answers to questions or problems, or if you later move to a more traditional implementation of these servers. Everything works the same, but things might be configured slightly differently, or located in a place different than some mentor might be suggesting you look. Just something to be aware of as you find your way around.

I hope this helps…

-k

Donal

I installed MAMP and Apache is running fine, but I can’t get MySQl to start up. Anyone else having this problem. I have found zero documentation on MAMP out there.

Donal

Kevster

I am new to MAMP and attempting to use it. I recently installed it with no serious problems. I need help on how to use it. I would like to create a website, but first develop if off line with MAMP. After I’ve figure out what I’m doing, I would go live with it. I just need some basic beginner help.

Anyone wiling to help a novice out?

imran

hello…..

can anyone help me enter data into mysql database
from a flash form using coldfusion components ?

i’m using web services and simply want to pass data from my flash form to my cfc while staying in flash…

any actionscript (or coldfusion code ‘cfc’) that anyone could provide or even links to other ressources on this specific topic would be awesome…

if someone could help me with this process i would be greatful…..

thank you in advance…

Imran Hashmi
http://www.visionstudio.co.uk

Glasgow Dave

Too right, I’ve just moved from Windows to MAC (with very little pain). And I have no idea how to config MYSQL etc. A few minutes after downloading MAPP it was and reamins running without any problems.

Comments are closed.