localhost

When I type

"http://localhost"

in Safari I get an error saying that

"Safari can’t connect to the server."

when I should be getting a message saying

"it works!"

However when I ping "localhost" I get this result

Ping has started…


PING localhost (127.0.0.1): 56 data bytes

64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.087 ms

64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.078 ms

64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.129 ms

64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.113 ms

64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.068 ms


--- localhost ping statistics ---

5 packets transmitted, 5 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 0.068/0.095/0.129/0.023 ms


which I understand to mean that it is working correctly. How can i resolve this issue as it means programmes like Timbuktu aren't recogonzing this computers DNS. Any ideas anyone ?

Posted on Jul 4, 2011 6:00 AM

Reply
21 replies

Jul 5, 2011 11:27 AM in response to twtwtw

By "and answer the question I asked earlier" I imagine you mean

"since "It Works!" is not the default web page apple provides, I suppose you've created a new web page. What did you call it and where did you put it?"


On my other client machines the file is "index.html.en" and the path is ~/Library/Webserver/Documents/index.html.en The file and path is exactly the same on the machine having trouble with localhost.


cd /etc now returns returns Mac-Pro:etc geoffreydyson$

ls returns

6to4.conf master.passwd

AFP.conf memberd.conf

ScreenSharing.launchd moduli

afpovertcp.cfg named.conf

aliases nanorc

aliases.db networks

amavisd.conf newsyslog.conf

apache2 newsyslog.d

appletalk.nvram.en0 notify.conf

asl.conf ntp-restrict.conf

authorization ntp.conf

authorization~previous openldap

auto_home pam.d

auto_master passwd

autofs.conf paths

bashrc paths.d

csh.cshrc periodic

csh.login php.ini

csh.logout php.ini.default

cups php.ini.default-5.2-previous

defaults php.ini.save

dnsextd.conf php.iniM-M

dumpdates postfix

efax.rc ppp

exports profile

find.codes protocols

fstab.hd racoon

ftpd.conf rc.cdrom.postWS

ftpusers rc.common

gettytab rc.netboot

group resolv.conf

hidemyip.conf rmtab

hostconfig rpc

hosts rtadvd.conf

hosts.equiv security

hosts~orig services

irbrc shells

kern_loader.conf smb.conf

krb5.keytab smb.conf.old

krb5.keytab~orig smb.conf.template

localtime smb.conf~orig

locate.rc snmp

mach_init.d ssh_config

mach_init_per_login_session.d sshd_config

mach_init_per_user.d sudoers

mail syslog.conf

mail.rc ttys

man.conf xgrid

manpaths xtab

manpaths.d zshenv



apachectl configtest returns

httpd: Syntax error on line 486 of /private/etc/apache2/httpd.conf: Could not open configuration file /Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/fmi-test.conf: No such file or directory

This is not surprising as there is no Filemaker Server on this machine.

I hope I am answering all your questions.

Jul 5, 2011 11:51 AM in response to Geoffrey Dyson

outdenting...


It sounds as though someone edited the php.ini file at some point (or possibly it just got corrupted somewhere). Unless you have a reason not to (if you don't know why I would say that, then you don't have a reason not to), delete the file /etc/php.ini and copy the default file (/etc/php.ini.default) as the new php.ini. you'll need admin access to do this, obviously; you may or may not need to sudo it.


Also, you have two php.ini.default files - that suggests to me that something unusual happened to this machine (someone tried to install an updated version of php, or ran a MAMP installation package, or something). just to be sure, type which php and whereis php in terminal to make sure you only have one version of php installed and that you're trying to use the correct version.


P.s. sorry - obvious point. turn the web server off and on to use the new ini file.

Jul 6, 2011 6:35 AM in response to twtwtw

Some of the old-school unix guys forget (or don't care) that there are GUI programmer's text editors that make life much simpler.


That's not why I regularly point to nano. If I point somebody that knows no shell commands at nano, I'm quite intentionally leading them into an area that they don't (yet) understand. It's been my experience that the folks that understand the GUI but don't understand the expectations of the plain text terminal environment are the most hazardous here. These folks can free-associate a different GUI text editor or a different output file format, and can lead themselves down a path that can be confusing and potentially difficult to troubleshoot. In one case I encountered, the person substituted Microsoft Office for TextWrangler, but did not mention that substitution. The tools attempting to read that particular configuration file were not happy. So yes, I point at the shell tools.

Jul 6, 2011 7:24 AM in response to twtwtw

The commands /etc/php.ini and /etc/php.ini.defaultgive me a "permission denied" notice. As I am the administrator of this computer, does this mean I have to log in as root to execute this?

Bothwhich php and whereis php in give the path as /usr/bin/php which I imagine is OK. Can you confirm this?


Sorry for the bad formatting, but I can't get rid of bold text.

Jul 6, 2011 7:46 AM in response to MrHoffman

Well, I understand that perspective, though I can't say I fully agree with it. it seems to me that if you're advising people to pound nails, one or two people are going to manage to bang their thumbs no matter what hammer you give them. There's no sense assuming that everyone you talk to is *that guy* and only giving out the special safety hammer. Nano is a fine editor, but takes a lot of getting used to if you were raised on GUI apps, and it's limited in comparison. It's much easier for a newb to cope with something like TextWrangler, and the 'ease-of-use' factor for the average person outweighs (in my mind, anyway) the 'hard-to-shoot-yourself-in-the-foot' factor that only applies to a few - pardon the term - trenchant dolts.

Jul 6, 2011 8:04 AM in response to Geoffrey Dyson

/etc/php.ini and /etc/php.ini.default are not commands, they are file locations (e.g., the file 'php.ini' in the folder 'etc'). if you're using the unix command cp to copy the default file into the new file, then you may have to use sudo (even as an admin, you need to use sudo to change things owned by root). e.g.:


sudo cp /etc/php.ini.default /etc/php.ini


as MrHoffman told you above. If you don't understand this, you really, really, really, really need to take the time to read up on the basics of using shell commands. try this for a start.


whereis will list all versions of the executable installed in the standard search paths of your machine, which will tell you which one the system defaults to; if they only list one then yu should be fine.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

localhost

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.