How can I set Apache to recognise .PHP files as PHP4? Every time I open the files with a PHP extension it shows me the actual source code instead of the processed file.
This confuses me...the extension for PHP4 files is .php...are you sure you don't mean PHP3; because that one requires files to be named with a .php3 extension?
Well, my server (localhost, and that means it is on my computer!) already recognises .php3 files as php3. However, I want to get a script called back-end working on my computer but that requires PHP4. I have already installed PHP4 on my computer but now what I need is the instruction to get Apache to recognise .php files as PHP4. I'm almost sure this will require fiddling about with the httpd.conf file.
It is the same set of directives but remove the 3 from them and it should work as long as you have installed PHP3 & 4 to different directories e.g.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
ScriptAlias /php3/ "c:/php3/"
AddType application/x-httpd-php3 .php3
Action application/x-httpd-php3 "/php3/php.exe"
The above Windows-specific code for setting up PHP4 on Apache will result in a very slow CGI-based installation.
The complete installation procedure and configuration steps for PHP4 as a loadable module under Apache for Linux (including deinstalling PHP3 and setting up Apache to recognize .php files as PHP4 scripts) are given in Part 1 of my series: Building a Database-Driven Web Site using PHP and MySQL. I highly recommend you use this method.
If anyone else is interested then PHP can be compiled as a module for Apache on Windows as well, it is available from http://www.geocities.com/ro_marius/mod_php4.html , it's not my page, but it is very useful if you don't own a C compiler or don't fancy attempting it - If you do then the site explains compiling it as well (It is well worth the effort to compile it).
------------------
Karl Austin KDA Web Services
"Everyone has a photographic memory. Some just don't have film."
Bookmarks