The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Networking (http://hintsforums.macworld.com/forumdisplay.php?f=14)
-   -   Trying to verify that Apache is running (http://hintsforums.macworld.com/showthread.php?t=96135)

lawyervon 11-23-2008 04:35 PM

Trying to verify that Apache is running
 
I'm going insane trying to install Wordpress locally on my MBP running 10.5.5.

I've been using tutorials online to get Apache started up, then PHP, then MySQL, then set up a virtual host address, then get Wordpress up and running.

Sadly, it's failing miserably.

Right now, the thing that's frustrating me is that I can't get the Apache test screen to show up so I know it's running properly. I got that up last night, but then a later step told me to move the files to a different folder, so it's gone now. I've since tried to get the files back in to test again, but can't get anything to come up.

BTW, all the files I'm talking about are located at Library/WebServer/Documents

When I go to my Sharing pref panel, turn Web Sharing on, and then click on my "Your computer's website" link, I get the following:

"Failed to Connect
Firefox can't establish a connection to the server at 10.200.18.86.
Though the site seems valid, the browser was unable to establish a connection."

I've tried the same using "127.0.0.1" and "localhost" in my browser, and get the same message.

What am I doing wrong?

ThreeDee 11-23-2008 07:45 PM

Do you have any other firewall software (other than the built-in one in OS X) running? It could be blocking port 80.

lawyervon 11-23-2008 10:02 PM

I know nothing that would be blocking any ports that has been changed since yesterday when it was working. Yesterday, I got Apache up and running, then I got MySQL up and running, then I put Wordpress in the Documents directory, moving the Apache files to another directory. Now nothing works.

I think my databases may be screwed up, and I'm trying to install PHPMyAdmin to work on that, but at this moment, I can't confirm that Apache is up because the Apache files don't seem to do anything after moving them back into the Documents folder.

cwtnospam 11-23-2008 10:14 PM

Save this to your sites folder and pull it up:
PHP Code:

<?php
phpinfo
();
?>

Does it have information about your PHP, MySQL, and Apache versions?

lawyervon 11-23-2008 11:07 PM

Quote:

Originally Posted by cwtnospam (Post 504844)
Save this to your sites folder and pull it up:
PHP Code:

<?php
phpinfo
();
?>

Does it have information about your PHP, MySQL, and Apache versions?

If "pull it up" means in a browser, nothing happens. I created the file in the Sites folder and tried to pull it up using the File/Open File from the Firefox menu.

There's also a pre-existing similar file under the /Library/WebServer/Documents/ folder, and nothing happens when I try to pull it up in the browser as well.

Oh, and I did make sure MySQL shows as running under the MySQL pref pane and Web Sharing is activated under the Sharing pref pane.

cwtnospam 11-23-2008 11:12 PM

Quote:

Originally Posted by lawyervon (Post 504850)
If "pull it up" means in a browser, nothing happens. I created the file in the Sites folder and tried to pull it up using the File/Open File from the Firefox menu.

If it's in your Sites folder, do this in your browser's URL:

Code:

http://127.0.0.1/~yourshortusername/thefilename.php

lawyervon 11-23-2008 11:37 PM

Is my shortname the one on my user folder?

If so, it doesn't bring up anything. I get:

"Failed to Connect
Firefox can't establish a connection to the server at 127.0.0.1.
Though the site seems valid, the browser was unable to establish a connection."

cwtnospam 11-23-2008 11:44 PM

Quote:

...but then a later step told me to move the files to a different folder,
What files did you move?

lawyervon 11-23-2008 11:52 PM

Quote:

Originally Posted by cwtnospam (Post 504855)
What files did you move?

Everything that was in the /Library/WebServer/Documents folder. I moved them all into a folder I called "apache docs". I have since moved everything back, trying to get it to work again.

So now Documents includes all the stuff I moved over to "apache docs". There also appears to be a PHP folder in there, as well as the PHPMyAdmin folder I put in there.

BTW, feel free to IM me. Info is in my profile.

lawyervon 11-24-2008 12:08 AM

Looking back on the procedure I used to get here, the phpinfo.php test worked fine several times in the past.

Since then, I've installed the MySQL.prefPane-leopardfix. And I've done that file moving. Just in case those have anything to do with this problem.

cwtnospam 11-24-2008 12:12 AM

Have you tried turning off web sharing, then turning it on again?

lawyervon 11-24-2008 12:12 AM

Yes. Many times. :-)

cwtnospam 11-24-2008 12:21 AM

Is your firewall on?
I can't think of anything in the Library/WebServer/Documents folder that might cause this.

lawyervon 11-24-2008 12:24 AM

Also, when I do this in Terminal:

/usr/local/mysql/bin/mysql test

it shows that MySQL is running.

lawyervon 11-24-2008 12:28 AM

Quote:

Originally Posted by cwtnospam (Post 504861)
Is your firewall on?
I can't think of anything in the Library/WebServer/Documents folder that might cause this.

Hmmm.. I just pulled up the Firewall, and the button for "Set access to specific services and applications" is marked, and "WebSharing" is in the box below.

I can't seem to get do anything with the WebSharing there. Can't highlight it. There's only a "+" down below.

cwtnospam 11-24-2008 12:30 AM

I'm on Tiger, so I can't tell you how, but see if you can turn off the firewall.

lawyervon 11-24-2008 12:34 AM

I've set it to accept all connections, but nothing has changed. I also turned Web Sharing off and then on after that, but nothing changed.

lawyervon 11-24-2008 12:38 AM

I'm trying to back out whatever changes I made, but nothing's working. I truly have no idea what's going on. No matter what I try, the browser "can't establish a connection to the server".

cwtnospam 11-24-2008 12:38 AM

Assuming that lawyervon is your shortusername, try:
http://127.0.0.1/~lawyervon/index.html

lawyervon 11-24-2008 12:47 AM

From everything I'm finding, it appears that john is my shortname

I've changed the URL to that, but nothing.

hayne 11-24-2008 04:00 AM

Please launch the "Terminal" application (under /Applications/Utilities) and copy & paste the following commands (all together), press Return, then copy & paste the results back here so we can see:


id
/usr/sbin/apachectl -t
sudo /usr/sbin/lsof -i -P | grep 80
ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"

lawyervon 11-24-2008 08:52 AM

Something odd happens when I do the cut and paste.

When I paste it, it gets al the way through the "Macintosh:~ john$ sudo /usr/sbin/lsof -i -P | grep 80" line shown below, so I pasted in the rest again, but it comes out as (see below):

ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"

instead of what I input, which was:

ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"

Anyway, below is the result:
Code:

Last login: Mon Nov 24 07:47:22 on ttys000
Macintosh:~ john$ id
uid=501(john) gid=501(john) groups=501(john),98(_lpadmin),80(admin)
Macintosh:~ john$ /usr/sbin/apachectl -t
Warning: DocumentRoot [/www/docs/dummy-host.example.com] does not exist
Syntax error on line 43 of /private/etc/apache2/extra/httpd-vhosts.conf:
CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs)
Macintosh:~ john$ sudo /usr/sbin/lsof -i -P | grep 80
ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"ps -aex | grep httpd
grep DocumentRoot /etc/apache2/httpd.conf
echo "done"mDNSRespo  24 _mdnsresponder    9u  IPv4 0x3c78380      0t0    UDP *:63550
mDNSRespo  24 _mdnsresponder  11u  IPv4 0x3c780f8      0t0    UDP *:53344
mDNSRespo  24 _mdnsresponder  12u  IPv4 0x3c78020      0t0    UDP *:54307
FileSyncA 164          john  15u  IPv4 0x67ea66c      0t0    TCP 192.168.0.102:49293->idisk.mac.com:80 (CLOSED)
StickyWin 174          john    4u  IPv4 0x544f270      0t0    TCP 192.168.0.102:49227->webx25.aruba.it:80 (CLOSE_WAIT)
firefox-b 344          john  45u  IPv4 0x4bfa66c      0t0    TCP 192.168.0.102:49306->12.120.101.14:80 (ESTABLISHED)
firefox-b 344          john  47u  IPv4 0x67efe64      0t0    TCP 192.168.0.102:49391->64.154.80.250:80 (ESTABLISHED)
firefox-b 344          john  49u  IPv4 0x67eea68      0t0    TCP 192.168.0.102:49313->host.lightcore.net:80 (ESTABLISHED)
firefox-b 344          john  64u  IPv4 0x69a2e64      0t0    TCP 192.168.0.102:49335->205.234.225.74:80 (ESTABLISHED)
Macintosh:~ john$ ps -aex | grep httpd
  460 ttys000    0:00.00 grep httpd
Macintosh:~ john$ grep DocumentRoot /etc/apache2/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/Library/WebServer/Documents"
# This should be changed to whatever you set DocumentRoot to.
    # access content that does not live under the DocumentRoot.
Macintosh:~ john$ echo "done"ps -aex | grep httpd
Macintosh:~ john$ grep DocumentRoot /etc/apache2/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/Library/WebServer/Documents"
# This should be changed to whatever you set DocumentRoot to.
    # access content that does not live under the DocumentRoot.
Macintosh:~ john$ echo "done"


hayne 11-24-2008 09:26 AM

Quote:

Originally Posted by lawyervon (Post 504890)
Code:

Macintosh:~ john$ /usr/sbin/apachectl -t
Warning: DocumentRoot [/www/docs/dummy-host.example.com] does not exist
Syntax error on line 43 of /private/etc/apache2/extra/httpd-vhosts.conf:
CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs)


The above shows your problem.
You seem to have introduced a syntax error in the Apache config files.

lawyervon 11-24-2008 10:46 AM

Here's what's in that document after the instructions at the very beginning. What's wrong? I backed out the one change I've made trying to add a virtual host setting:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


# Override the default httpd.conf directives. Make sure to
# use 'Allow from all' to prevent 403 Forbidden message.
<Directory />
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
</Directory>


#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/www/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/www/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log common"
</VirtualHost>

lawyervon 11-24-2008 11:07 AM

I've removed the CustomLog entries and get the same error

lawyervon 11-24-2008 01:07 PM

What directory are these /www/ references referring to? I don't find a /www/ subdirectory anywhere.

cwtnospam 11-24-2008 01:39 PM

Quote:

Originally Posted by lawyervon (Post 504936)
What directory are these /www/ references referring to? I don't find a /www/ subdirectory anywhere.

Which would explain why it doesn't work. ;)

I think you copied an example path when you should have used a path to an actual site that you had set up.

lawyervon 11-24-2008 01:41 PM

Actually those example paths were already there when I opened up the file to create my entry. I have no idea where they came from. Should I delete those example paths or at least hash them out?

cwtnospam 11-24-2008 01:46 PM

In case you need the examples in the future, I'd put the # in front of them


#<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
#DocumentRoot "/www/docs/dummy-host.example.com"
#ServerName dummy-host.example.com
#ServerAlias www.dummy-host.example.com
#ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
#CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
#</VirtualHost>

#<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host2.example.com
#DocumentRoot "/www/docs/dummy-host2.example.com"
#ServerName dummy-host2.example.com
#ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
#CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log common"
#</VirtualHost>

lawyervon 11-24-2008 02:00 PM

OK -- I've commented out everything. Guess I'll need to rethink virtual hosting, or do it right next time. Regardless, that works. I've now got the Apache screen to show up. Yea! Thanks!

Terminal now says the following. What's all this mean?:

Last login: Mon Nov 24 12:54:39 on ttys000
Macintosh:~ john$ id
uid=501(john) gid=501(john) groups=501(john),98(_lpadmin),80(admin)
Macintosh:~ john$ /usr/sbin/apachectl -t
Syntax OK
Macintosh:~ john$ sudo /usr/sbin/lsof -i -P | grep 80
ntpd 14 root 21u IPv6 0x3c7e380 0t0 UDP *:123
FileSyncA 175 john 10u IPv4 0x6dfca68 0t0 TCP 10.10.100.60:52791->idisk.mac.com:80 (CLOSED)
StickyWin 185 john 4u IPv4 0x5fcd66c 0t0 TCP 10.10.100.60:49201->webx25.aruba.it:80 (CLOSED)
Adium 278 john 22u IPv4 0x6e6b66c 0t0 TCP 10.10.100.60:49808->kc-in-f125.google.com:5222 (ESTABLISHED)
Mail 279 john 31u IPv4 0x5fcd270 0t0 TCP 10.10.100.60:49670->idisk.mac.com:80 (CLOSED)
Mail 279 john 34u IPv4 0x636666c 0t0 TCP 10.10.100.60:52805->mu-in-f111.google.com:993 (ESTABLISHED)
firefox-b 309 john 6u IPv4 0x5f7166c 0t0 TCP 10.10.100.60:52545->72.32.115.41:80 (ESTABLISHED)
firefox-b 309 john 49u IPv4 0x5d02e64 0t0 TCP 10.10.100.60:52857->12.120.101.14:80 (ESTABLISHED)
httpd 2293 root 3u IPv6 0x3c81720 0t0 TCP *:80 (LISTEN)
httpd 2297 _www 3u IPv6 0x3c81720 0t0 TCP *:80 (LISTEN)
httpd 2298 _www 3u IPv6 0x3c81720 0t0 TCP *:80 (LISTEN)
Macintosh:~ john$ ps -aex | grep httpd
2293 ?? 0:00.69 /usr/sbin/httpd -D FOREGROUND
2297 ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
2298 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
2320 ttys000 0:00.00 grep httpd
Macintosh:~ john$ grep DocumentRoot /etc/apache2/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/Library/WebServer/Documents"
# This should be changed to whatever you set DocumentRoot to.
# access content that does not live under the DocumentRoot.
Macintosh:~ john$ echo "done"

lawyervon 11-24-2008 02:08 PM

I now have Apache working and I have my phpinfo.php file producing results.

Now I'm trying to get phpMyAdmin to work so I can work on my databases because I think my ultimate problem may lie in the database connections and permissions.

When I pull up localhost/phpmyadmin, I get a welcome to phpmyadmin screen with the following errors:
"The configuration file now needs a secret passphrase (blowfish_secret).
Cannot load mcrypt extension. Please check your PHP configuration."

If it matters, my /Library/WebServer/Documents folder now contains all the Apache files, plus a PHP folder, the PHPMyAdmin folder, and the folder containing my Wordpress files.

I thought I'd created a secret passphrase in the config.inc.php file by filling in a word where the xxxx are:
$cfg['xxxx'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

I'M GOING TO MOVE THIS DISCUSSION UNDER A NEW THREAD TITLE FOR CLARITY

hayne 11-24-2008 04:00 PM

Quote:

Originally Posted by lawyervon (Post 504954)
What's all this mean?:
Code:

Macintosh:~ john$ id
uid=501(john) gid=501(john) groups=501(john),98(_lpadmin),80(admin)


That shows your username and groups.
Quote:

Code:

Macintosh:~ john$ /usr/sbin/apachectl -t
Syntax OK


That shows that the Apache config files are ok.
Quote:

Code:

Macintosh:~ john$ sudo /usr/sbin/lsof -i -P | grep 80
ntpd        14          root  21u  IPv6 0x3c7e380      0t0    UDP *:123
FileSyncA  175          john  10u  IPv4 0x6dfca68      0t0    TCP 10.10.100.60:52791->idisk.mac.com:80 (CLOSED)
StickyWin  185          john    4u  IPv4 0x5fcd66c      0t0    TCP 10.10.100.60:49201->webx25.aruba.it:80 (CLOSED)
Adium      278          john  22u  IPv4 0x6e6b66c      0t0    TCP 10.10.100.60:49808->kc-in-f125.google.com:5222 (ESTABLISHED)
Mail      279          john  31u  IPv4 0x5fcd270      0t0    TCP 10.10.100.60:49670->idisk.mac.com:80 (CLOSED)
Mail      279          john  34u  IPv4 0x636666c      0t0    TCP 10.10.100.60:52805->mu-in-f111.google.com:993 (ESTABLISHED)
firefox-b  309          john    6u  IPv4 0x5f7166c      0t0    TCP 10.10.100.60:52545->72.32.115.41:80 (ESTABLISHED)
firefox-b  309          john  49u  IPv4 0x5d02e64      0t0    TCP 10.10.100.60:52857->12.120.101.14:80 (ESTABLISHED)
httpd    2293          root    3u  IPv6 0x3c81720      0t0    TCP *:80 (LISTEN)
httpd    2297          _www    3u  IPv6 0x3c81720      0t0    TCP *:80 (LISTEN)
httpd    2298          _www    3u  IPv6 0x3c81720      0t0    TCP *:80 (LISTEN)


That shows all the processes (at the left) that are listening on port 80 (used by HTTP) as well as a few others that got matched inadvertently since they have a "80" somewhere.
Quote:

Code:

Macintosh:~ john$ ps -aex | grep httpd
 2293 ??        0:00.69 /usr/sbin/httpd -D FOREGROUND
 2297 ??        0:00.01 /usr/sbin/httpd -D FOREGROUND
 2298 ??        0:00.00 /usr/sbin/httpd -D FOREGROUND
 2320 ttys000    0:00.00 grep httpd


That shows all the processes running with "httpd" in their command-line.
Quote:

Code:

Macintosh:~ john$ grep DocumentRoot /etc/apache2/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/Library/WebServer/Documents"
# This should be changed to whatever you set DocumentRoot to.
    # access content that does not live under the DocumentRoot.


That shows the lines in the Apache config file relating to DocumentRoot.

lawyervon 11-24-2008 04:03 PM

Wow - thanks!

I've been wondering how my Mac knows to look in the Library/WebServer/Documents folder instead of the Sites folder. I'm assuming it's that entry in the Apache config file relating to the DocumentRoot.

Thanks everyone for your help here. SO MUCH! I never would have figured this out without you. As you'll see over in the other discussion about Wordpress once I got the Apache up and running, I've now got Wordpress running just fine. Thanks so much again!

http://forums.macosxhints.com/showthread.php?t=96155

shaolex 03-04-2009 10:55 PM

I'm having a similar problem. Apache used to work just fine on my MacBook Pro, but I hadn't tried to use it in probably 6+ months until yesterday. Regardless of what I try, I get "Page Load Error" "Failed to Connect" message from Firefox. I've tried using Wildcat (my computer name), localhost, 127.0.0.1, and several variations at the hostname with no luck. I have placed a small index file in both /Library/WebServer/Documents and /Users/Ben/Sites to insure the serving directory isn't the problem.

I stumbled across this thread while doing some research and I'm hoping someone can help me out. I've included my results to the series of Terminal commands from earlier...
Ben@Wildcat[/private/etc/apache2] [22:53:39]> id
uid=501(Ben) gid=501(Ben) groups=501(Ben),98(_lpadmin),81(_appserveradm),101(com.apple.access_screensharing),79(_appserverusr),80(admin)
Ben@Wildcat[/private/etc/apache2] [22:53:40]> /usr/sbin/apachectl -t
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.105 for ServerName
Syntax OK
Ben@Wildcat[/private/etc/apache2] [22:53:40]> sudo /usr/sbin/lsof -i -P | grep 80
Password:
AppleVNCS 280 Ben 4u IPv6 0x4f61258 0t0 TCP *:5900 (LISTEN)
Dropbox 306 Ben 12u IPv4 0x972da68 0t0 TCP Wildcat:49172->208.43.202.16-static.reverse.softlayer.com:80 (ESTABLISHED)
firefox-b 429 Ben 6u IPv4 0x9cc1a68 0t0 TCP Wildcat:49378->64.154.80.250:80 (ESTABLISHED)


All times are GMT -5. The time now is 07:59 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.