PDA

View Full Version : Trouble Enabling Apache on MacBook




UCONN
Aug 23, 2008, 07:42 PM
I'm trying to teach myself PHP. I began by trying to enable Apache (MacBook running Leopard) by turning on Web Sharing in the System Preferences. I get the little green button that says Web Sharing on but when I click on either of the 2 addresses shown, when Safari launches it says "Safari can't find the server." If I enter http://localhost/ for the address, I get the same result. I thought at least this step would be easy. What am I doing wrong?

Thanks.

-dale



UCONN
Aug 23, 2008, 09:15 PM
Searching this and other forums for help on this topic, I see references to a folder named httpd which is supposed (?) to be in the private/etc directory. I do not have this folder and after turning web sharing on, the following error message repeats in console:


8/23/08 10:00:30 PM org.apache.httpd[721] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
8/23/08 10:00:30 PM org.apache.httpd[721] Unable to open logs
8/23/08 10:00:30 PM com.apple.launchd[1] (org.apache.httpd[721]) Exited with exit code: 1
8/23/08 10:00:30 PM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds
8/23/08 10:00:40 PM org.apache.httpd[725] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
...............and on and on

Do I need to create this folder? If so, what belongs in it?

Thanks.

lee1210
Aug 23, 2008, 10:13 PM
From the terminal, type:
which httpd

If no files are found, try:
locate httpd

Is anything found? If httpd is present, it may be the case that the log file can't be opened. My installation on 10.4 uses /private/var/log/httpd/, whereas it looks like yours is going to apache2 instead. This can probably be modified in httpd.conf, or you could just:
sudo mkdir /private/var/log/apache2/

-Lee

sord
Aug 23, 2008, 11:04 PM
From the terminal, type:
which httpd

If no files are found, try:
locate httpd

Is anything found? If httpd is present, it may be the case that the log file can't be opened. My installation on 10.4 uses /private/var/log/httpd/, whereas it looks like yours is going to apache2 instead. This can probably be modified in httpd.conf, or you could just:
sudo mkdir /private/var/log/apache2/

-Lee
According to his error message, /private/var/log/apache2/ doesn't exist, where httpd does exist.

From terminal, do "sudo mkdir /private/var/log/apache2" followed by "sudo chmod 751 /private/var/log/apache2" followed by "sudo chown root:wheel /private/var/log/apache2"

UCONN
Aug 24, 2008, 10:25 AM
Hey guys. Thanks for the replies and suggestions. Just for clarification on what I'm seeing - I have neither /private/var/log/apache2/ nor /private/var/log/httpd/.

lee1210
Aug 24, 2008, 10:33 AM
Hey guys. Thanks for the replies and suggestions. Just for clarification on what I'm seeing - I have neither /private/var/log/apache2/ nor /private/var/log/httpd/.

Trying creating apache2 with the instructions above and see if that helps.

-Lee

UCONN
Aug 24, 2008, 12:24 PM
Thanks!! I created the apache2 directory in the private/var/log directory and turned web sharing on. Both addresses (computer's website and personal website) now display pages. The newly created apache2 directory now has 3 files in it. The error_log file contains the following:

[Sun Aug 24 12:49:13 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Aug 24 12:49:14 2008] [notice] Digest: generating secret for digest authentication ...
[Sun Aug 24 12:49:14 2008] [notice] Digest: done
[Sun Aug 24 12:49:14 2008] [notice] Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7l DAV/2 PHP/5.2.6 configured -- resuming normal operations

Look okay?
Next I am going to try to enable PHP per instructions here:
http://foundationphp.com/tutorials/php_leopard.php

and then download MySQL. Hope this works:o

Thanks again.

davedelong
Aug 25, 2008, 10:05 AM
Next I am going to try to enable PHP per instructions here:
http://foundationphp.com/tutorials/php_leopard.php

and then download MySQL. Hope this works:o

Thanks again.

I'm not sure if you figured this out or not, but Apache on Leopard isn't stored in /private/etc/httpd. It's in /private/etc/apache2

Enabling PHP is as simple as uncommenting the line in httpd.conf, like that link instructs.

As for installing MySQL, this page has excellent instructions:
http://www.red91.com/2007/12/14/installing-mysql-on-leopard

Dave

kalimba
Aug 25, 2008, 12:05 PM
Is installing MAMP (http://www.mamp.info/) a workable option for you?

localoid
Aug 25, 2008, 01:25 PM
UCONN, is this happening on a Leopard system that was upgraded from Tiger, as opposed to a fresh Leopard install? I've heard some claiming the Tiger to Leopard upgrade can cause problems like what you're experiencing because some of the new Apache files aren't written/upgraded correctly.