Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Search Search
Search for:
Tech Support Guy > > >

Enabling PHP on Mac OS 10.6


(!)

andynic's Avatar
andynic andynic is offline
Computer Specs
Member with 235 posts.
THREAD STARTER
 
Join Date: May 2007
Location: Amsterdam
Experience: Beginner
24-Apr-2011, 04:27 AM #1
Enabling PHP on Mac OS 10.6
Hi,

I am totally new to PHP.

Am developing on Mac OS X 10.6.7, Apache Server 2.2.17, MySQL 5.1.39.
All of the above works fine when I develop web pages using Perl CGI with Perl DBI.

I am now trying to learn PHP and am having difficulty getting the first test script to run.

Rather than installing MAMP as recommended in Robin Nixon's book (O'Reilly) on the subject,
I'd like to just enable PHP 5 which is dielivered with the Mac OS X.

To that end I have followed the instructions at http://maestric.com/doc/mac/apache_p...l_snow_leopard
(which I found referenced on the Apple Support Forums).

The simple test script that I am trying to run is shown at the end of this post (file a.php):

If I put the URL address file:///Users/andynic/a.php in Safari, rather then putting up "Welcom to PHP First Test"
it puts up the code you see above.

Any idea about what I have done wrong?

Thanks for your help.
Andynic

File a.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhml1-strict.dtd">

<?php
$name = "First Test"; // declaration
?>

<html>
<head>
<title>Test PHP</title>
</head>
<body style='font-family:Arial; font-size:18px;'>
Welcome to PHP, <?php print( "$name" ); ?>
</body>
</html>
andynic's Avatar
andynic andynic is offline
Computer Specs
Member with 235 posts.
THREAD STARTER
 
Join Date: May 2007
Location: Amsterdam
Experience: Beginner
24-Apr-2011, 04:41 AM #2
Additional information:

If I enter this in the Safari URL address field:
http://localhost/gfrmDevBin/a.php
where "gfrmDevBin" is a location defined in the httpd.conf file, I get:
Internal Server Error

The error in the Apache error_log file is:
Premature end of script headers: a.php
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
mac os x 10.6, php

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑