harlow
asked on
PHP Apache 2 Mac OS X
This is probably really simple, but I can't find a targeted answer in the archives. I am a neophyte on running a web server, but I have Apache 2, PHP 5, MySQL, etc running happily on MacOS X 10.3.9. Here is the problem. If I embed a PHP script in an HTML document like so:
<HTML>
<HEAD>
</HEAD>
<BODY>
This is html
<?php
print ("This is php\n");
?>
</BODY>
</HTML>
the server does not seem to understand the script; it just sends out the php source text as if it were part of the html. In my httpd.conf, I have the following statements:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-so urce .phps
DirectoryIndex index.html index.php
I can't figure out what is missing here. If I just browse a file foo.php with a php script in it, it works happily, but the same script embedded in html does not work. Anyone got any ideas?
Thanks
JEH
<HTML>
<HEAD>
</HEAD>
<BODY>
This is html
<?php
print ("This is php\n");
?>
</BODY>
</HTML>
the server does not seem to understand the script; it just sends out the php source text as if it were part of the html. In my httpd.conf, I have the following statements:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-so
DirectoryIndex index.html index.php
I can't figure out what is missing here. If I just browse a file foo.php with a php script in it, it works happily, but the same script embedded in html does not work. Anyone got any ideas?
Thanks
JEH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad it works ;-)
Have fun coding
Have fun coding
ASKER
<HTML>
<HEAD>
<TITLE>First PHP Script</TITLE>
</HEAD>
<BODY>
<?PHP
print ("Hello, world!");
?>
</BODY>
</HTML>
You are right on the money: I was using a .html extension on this kind of file. When I make it .php, it works fine.
Thanks!
JEH