Click to See Complete Forum and Search --> : Parsing PHP in .html files Mac OSX


gmdavis
12-20-2002, 04:46 PM
After enabling Apache and PHP on my Mac (OSX Jaguar) I have been exited about using it as a development environment for my PHP scripts. This has been great to test code without uploading it to my web hosting service.

The problem I have is I cannot get .html files to be parsed by the PHP engine.

First, I edited the .htaccess file in my Sites folder by adding the code:

AddType application/x-httpd-php .htm .html

(This worked on my web server but not on my Mac.)

Then, I found out I had to edit /etc/httpd/httpd.conf to change the line "AllowOverride None" to read "AllowOverride All". I did this but it didn't work. I still cannot get html files to process the php within. What do I need to do next?

I'm new to PHP and UNIX so please speak slowly. ;)

dalecosp
12-22-2002, 04:45 PM
Hmm, did you restart apache?

Try putting the line that you put in .htaccess in httpd.conf directly, and then restart Apache.....

HTH,

largo
12-27-2002, 02:55 PM
In your httpd.conf file you have the same application/x-... line. Add .html to the list of extensions for php. That should do the trick.

Mine is pasted below (from httpd.conf)

AddType application/x-httpd-php .php .html

hope this helps.

gmdavis
12-27-2002, 03:25 PM
Thanks. That worked.

Still, it should have worked in the .htaccess file too.

dartcol
10-13-2003, 03:09 PM
I though I'd tag on to this old thread with a very similar problem - parsing .html through php.

I've just taken the step away from IIS and into the apache world. Got apache server 2.0.47 up and running. Got PHP 4.3.3 up and running. Together they happily churn out .php pages as well as .html pages but no joy with running .html through the php parser.

The php4ts.dll and phpapache2.dll are safely ensconced in the c:/windows/system folder. The httpd.conf file for apache contains the above mentioned line plus

LoadModule php4_module /windows/system/php4apache2.dll

The document root is patently pointing in the right direction. It just won't do its funky stuff with the .html file containing php.

You can probably tell I'm at the end of a very long tether. I've tried following the advice in the install.txt that comes with full version of php. I've tried following the advice on php.net as well as theat of the latest person to comment. I've been away and gone to builder.com for more advice on putting the two together and leave me with the same problem. No parsing!

If you have any suggestions, I'd be more than grateful to hear them.

Cheers.

dalecosp
10-13-2003, 03:31 PM
Hmm, I'm not too good at Apache on Windows. Come to think of it, not good at IIS, either. I guess for starters you'd make sure that you're writing to correct httpd.conf file, but I doubt that you've got more than one by accident (can happen on various 'Nixes).

If you have the AddType directive configured as above, it should work. Make sure the AddType directive is in a code block that's getting evaluated (for example, if it's in an IF block that's not applicable to your Apache setup.)

In 'Nix, you can issue

$apachectl configtest

and see if all's right in the httpd.conf file. Then try a restart.

Then, you've probably seen this...

http://us2.php.net/manual/en/faq.installation.php#faq.installation.phpandiis

However, I have to assume you've tried all this, so I'm rather at my wit's end too.

My apache on FBSD will even parse *.asp as php --- but I just did that to be mean, heh.

dartcol
10-14-2003, 12:03 PM
Thanks for that. I hadn't seen that page but there wasn't anything there that I haven't already done. If you don't mind, let me just go through the things I did.

1) Set up Apache on the c:\ drive.
2) Alter the httpd.conf file:

add LoadModule php4_module /windows/system/php4apache2.dll in the loadmodule section in section 1
add AddType application/x-httpd-php .php .html to the other two types given in section 2
add index.php to the DirectoryIndex also in section 2
change the doc root files to point to the root directory of my development directory
include ScriptAlias /php/ "c:/php/" to point to "c:/php/" to enable the server to find php.exe

3) Install php on c:\

configure php.ini and save to c:\windows
place a copy of php4apache2.dll and php4ts.dll in the c:\windows\system folder.

4) Stop and then start the server.

Did I miss something along the way? Or did I just screw it up on the way! Any morsel of help devoured hungrily.

dalecosp
10-14-2003, 03:34 PM
Sorry, friend, I don't know much more.

Anything in httpd-error.log?

dartcol
10-14-2003, 11:59 PM
I'll check it when I get home from the office. Thanks for your help though. At least I know that I'm not going completely barmy.

dartcol
10-15-2003, 02:21 PM
Erm...you"re either going to kill me or have a good laugh at my expense...so much so that I think it belongs here (http://www.phpbuilder.com/board/showthread.php?s=&threadid=10226877&perpage=40&pagenumber=3)

:o