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)

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.