Results 1 to 6 of 6
  1. #1


    Member Since
    Dec 15, 2008
    Posts
    3
    Apache works, but PHP will not
    I am working on getting a client version of Apache and PHP working on my MacBook Pro. I installed Leopard on it sometime ago (10.5.5 as of today).

    I am trying to set up Apache and php. So far I have the Apache server working fine for the system directory and my Sites directory.

    I downloaded php from Marc Liyanage - Software - Mac OS X Packages - PHP as it seemed like Adobe wanted me to (I will be using Dreamweaver CS4 for development). The install of the download seemed to work fine....but...

    ..when I run the file called timetest.php (that has the following php code):

    <p>This page was created at
    <b><?php echo date("h:i:s a", time()); ?></b> on the computer running PHP.</p>

    I get the following output in Firefox..(when it is supposed to print out the current time and date)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    &lt;p&gt;This page was created at<br />
    &lt;b&gt;&lt;?php echo date(&quot;h:i:s a&quot;, time()); ?&gt;&lt;/b&gt; on the computer running PHP.&lt;/p&gt;
    </body>
    </html>

    I am also aware that I can use the bundled version of php (if I did not hammer it with my download) by taking out the comment on the

    #LoadModule php5_module libexec/apache2/libphp5.so

    line of the hhtpd.conf file....but I tried that with no better result.

    Anybody run across this before? And I would like to solve this problem and don't want to consider MAMP at this time.

  2. #2

    jimd144's Avatar
    Member Since
    Dec 02, 2008
    Location
    Sacramento
    Posts
    145
    Specs:
    MacBook Pro
    did you restart apache after taking out the comment?

  3. #3


    Member Since
    Dec 15, 2008
    Posts
    3
    Hello Jim,

    Yes. I have restarted web sharing.

    Interestingly, the downloaded version reacts differently than the embedded version. When I take the comment out of the httpd.conf file I get the following output ...which is simply the code being restated in a browser page...weird...

    <p>This page was created at
    <b><?php echo date("h:i:s a", time()); ?></b> on the computer running PHP.</p>

    It's like the code is being generated/read, but not executed. It generates a lot more code as per my original post with the downloaded php. But does not actually run it. As I said earlier, it runs any html correctly.

  4. #4

    jimd144's Avatar
    Member Since
    Dec 02, 2008
    Location
    Sacramento
    Posts
    145
    Specs:
    MacBook Pro
    Did you follow this procedure?

    PHP: Installation on Mac OS X - Manual


    I run it just fine.
    You are right, the php is not running, as you are simply getting http returns when php should be interpreting it.

  5. #5


    Member Since
    Dec 15, 2008
    Posts
    3
    Thumbs up Resolved
    OK Jim...I followed the link you gave me and somehow ended up here...

    Enabling PHP in Mac OS X 10.5

    I followed these instructions to the letter and now it works. Thanks for getting me down this path!

    These instructions are the best and most complete I have seen yet. This David Powers seems to have some interesting books listed on this site....as I will be using Dreamweaver CS4....

    Thanks...

  6. #6

    jimd144's Avatar
    Member Since
    Dec 02, 2008
    Location
    Sacramento
    Posts
    145
    Specs:
    MacBook Pro
    Cool. Now on to MySQL!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Apache and PHP
    By giszzmo in forum OS X - Operating System
    Replies: 3
    Last Post: 09-24-2011, 04:16 PM
  2. Resetting PHP and Apache
    By Dashman in forum OS X - Operating System
    Replies: 4
    Last Post: 11-19-2007, 05:35 AM
  3. Apache & PHP
    By Peakoverload in forum Switcher Hangout
    Replies: 1
    Last Post: 09-04-2007, 04:22 AM
  4. Apache/PHP
    By psychotoe in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 08-12-2004, 06:10 PM
  5. Apache + PHP + MySQL
    By Emrys in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 11-14-2003, 01:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •