Trouble Enabling Apache on MacBook

Discussion in 'Mac Programming' started by UCONN, Aug 23, 2008.

  1. macrumors newbie

    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?


  2. macrumors newbie

    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[1] (org.apache.httpd[721]) Exited with exit code: 1
    8/23/08 10:00:30 PM[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?

  3. macrumors 68040


    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/

  4. macrumors 6502

    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"
  5. macrumors newbie

    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/.
  6. macrumors 68040


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

  7. macrumors newbie

    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:

    and then download MySQL. Hope this works:eek:

    Thanks again.
  8. macrumors member


    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:

  9. macrumors regular

  10. macrumors 68020


    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.

Share This Page