Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 31, 2012, 10:28 AM   #1
Justkeepmoving
macrumors newbie
 
Join Date: Jan 2012
MAMP, MySQL, Netbeans help- "safari cannot connect to localhost"

Hi all,

Very new to using MAMP and not too hot with running diagnostics or using terminal (though i know some basics).

My problem is i think in setting up MAMP, MySQL workbench and Netbeans to work together... the actual issue is when i click on 'run project' in Netbeans, it opens safari and says that it can't connect to localhost:8888. i am trying to run an .html page.

I ran 'sudo apachectl -t' through terminal as mentioned in another forum and it said 'syntax ok'. Not sure how relevant this is.

Using Mac OS X 10.6.8. I had some issues setting up a new server instance in MySQL workbench- I'm still not sure that my settings are right though the paths check out:

path URL/admin tool: /Applications/MySQLWorkbench.app
Path to start command: /Applications/MAMP/bin/startMysql.sh
Path to stop command: /Applications/MAMP/bin/stopMysql.sh

Oh, also thought it was weird that my basic MySQL server properties (netbeans>services>databases>properties) defines the port i'm using as 3306. Though my MAMP port as defined on the starter page that opens in my browser on opening MAMP is 8889. And Safari is telling me it cant connect to localhost:8888. Why are all these different and should they be the same? The new server instance that i created in MySQL workbench was created on 3306.

Well, thats all the info i can think to provide. Any advice appreciated or links to a good MAMP configuration tutorial perhaps (I have been following a WAMP config tutorial, but it is different. Some of the paths and file names are different to mine and even some of the steps are different. Can't find anything online that explains what i need to know)

Thank you, really appreciate any responses to be able to finally preview my site!

P.S. My apologies- this is a repost from the 'macbook pro' thread as i started the thread in the wrong place first time around, and couldn't simply move it.
Justkeepmoving is offline   0 Reply With Quote
Old Feb 8, 2012, 04:16 AM   #2
4np
macrumors 6502a
 
4np's Avatar
 
Join Date: Feb 2005
Location: The Netherlands
Hi,

It is not really clear what your are trying to do, but as you are using MAMP I assume you are trying to program PHP in Netbeans, to run on MAMP's Apache Web server?

PHP does not need to be compiled, as it is executed (interpreted) on page request. So you do not need to 'run' a project as it is being interpreted whenever a page is being requested.

So you just need to code in Netbeans (or any other IDE or text editor), and just browse to localhost (I set my Apache port back to 80).

Note that MAMP indeed uses it's own ports, not to conflict with any other possible running instances. Also, privileged ports (below 1024) require root access, so setting Apache to port 80 would require you to enter your administrator password when you try to run MAMP. Note that you can easily change the ports configured in MAMP by just running the bundled MAMP application...

Also note that MAMP is only able to run one site, and MAMP Pro (which you have to buy) is able to run more. However, it is extremely easy to allow multiple sites (virtual hosts) by just editing the httpd.conf. I always develop in ~/Workspace and I have created a folder ~/Workspace/apache to hold my apache virtual host configuration files. Defining host names in /etc/hosts and creating their respective virtual host configurations allows for running multiple virtual hosts from within MAMP:

Quote:
ME@mbp ~ $ tail -n 1 /Applications/MAMP/conf/apache/httpd.conf
Include /Users/ME/Workspace/apache/*.conf
ME@mbp ~ $
And an example virtual host file:

Quote:
ME@mbp ~ $ cat ~/Workspace/apache/blog.conf
<VirtualHost *:80>
ServerAdmin me@mydomain.com
ServerName blog
ServerAlias dev.blog.domain.com

DocumentRoot /Users/ME/Workspace/php/blog/htdocs/

ErrorLog /Users/ME/Workspace/php/blog/logs/domain.com_blog-error_log
CustomLog /Users/ME/Workspace/php/blog/logs/domain.com_blog-access_log combined

<Directory /Users/ME/Workspace/php/blog/htdocs/>
AllowOverride FileInfo Indexes
</Directory>
</VirtualHost>

ME@mbp ~ $
and a hosts entry:

Quote:
ME@mbp ~ $ cat /etc/hosts

...

127.0.0.1 blog dev.blog.domain.com

...

ME@mbp ~ $
When you now run MAMP you can just browse to http://blog/ and see the blog (a wordpress installation).

This allows me to update MAMP whenever I want, and I just have to append that one line to MAMP's httpd.conf to have my setup working again...

Good luck...

Last edited by 4np; Feb 8, 2012 at 04:26 AM.
4np is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Resetting MySQL password and Sudo issues. fraser1980 OS X 5 Oct 3, 2012 12:46 PM
Why does Mac OS say 3 users are connected to my shares? I'm the only one connected? alexreich Mac OS X Server, Xserve, and Networking 7 Oct 2, 2011 02:16 PM
Resolved: cannot connect to home wifi with iphone 4 :/ daniel-shi iPhone Tips, Help and Troubleshooting 8 Sep 26, 2011 02:23 PM
Cannot Update my apps - cannot connect to itunes henneth iPad Apps 3 Nov 8, 2010 11:32 AM
Macbook Pro connected wirelessly to Netgear DG834 but cannot connect to the Internet atlanticza Mac Basics and Help 3 Jul 25, 2009 02:47 PM


All times are GMT -5. The time now is 02:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC