Apache works, but PHP will not

Joined
Dec 15, 2008
Messages
3
Reaction score
0
Points
1
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>
<p>This page was created at<br />
<b><?php echo date("h:i:s a", time()); ?></b> on the computer running PHP.</p>
</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.
 
Joined
Dec 2, 2008
Messages
145
Reaction score
3
Points
18
Location
Sacramento
Your Mac's Specs
MacBook Pro
did you restart apache after taking out the comment?
 
OP
M
Joined
Dec 15, 2008
Messages
3
Reaction score
0
Points
1
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.
 
OP
M
Joined
Dec 15, 2008
Messages
3
Reaction score
0
Points
1
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...
 
Joined
Dec 2, 2008
Messages
145
Reaction score
3
Points
18
Location
Sacramento
Your Mac's Specs
MacBook Pro
Cool. Now on to MySQL!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top