Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

UCONN

macrumors newbie
Original poster
Jul 4, 2008
7
0
West Hartford, Connecticut
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

macrumors newbie
Original poster
Jul 4, 2008
7
0
West Hartford, Connecticut
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

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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

macrumors 6502
Jun 16, 2004
352
0
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

macrumors newbie
Original poster
Jul 4, 2008
7
0
West Hartford, Connecticut
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

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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

macrumors newbie
Original poster
Jul 4, 2008
7
0
West Hartford, Connecticut
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:eek:

Thanks again.
 

davedelong

macrumors member
Sep 9, 2007
50
0
Right here.
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:eek:

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
 

localoid

macrumors 68020
Feb 20, 2007
2,447
1,739
America's Third World
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.