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

Similar Threads
thread Thread Starter Forum Replies Last Post
Any way to make it so the "back" and "forward" buttons in a Safari never disappear? TH55 iOS 7 71 Sep 11, 2014 08:23 PM
Mavericks and range of issues (netbeans/MAMP) kevinyeandel OS X 0 Mar 7, 2014 10:02 AM
Safari Extension - "Safari can't use javascript for this action" hollerz Mac Programming 0 Mar 15, 2013 03:52 AM
Xdebug Not Working (MAMP / Netbeans) turbobass Web Design and Development 1 Jul 14, 2012 11:01 PM
Safari problem - "Safari canít save the file" GeorgeTheBest Web Design and Development 0 Jun 14, 2012 03:37 AM

Forum Jump

All times are GMT -5. The time now is 01:33 AM.

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

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