[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PHP4 & Apache



On Wed, Oct 11, 2000 at 01:35:18PM +0000, Steve Simons wrote:
> Could someone please explain, in idiot-level detail, how to get a .php
> file to display correctly in Netscape.
> 
> I apt-get installed PHP4 (which included Apache) a few days ago.  I've
> started Apache okay with:
> 
> LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php.source .phps
> 
> in /etc/apache/httpd.conf, and:
> 
> #AddType application/x-httpd-php3 .phtml
> #AddType application/x-httpd-php3-source .phps
> AddType application/x-httpd-php .php3
> AddType application/x-httpd-php .php4
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
> 
> in /etc/apache/srm.conf.  I also have:
> 
> application/x-httpd-php				phtml pht php
> application/x-httpd-php3			php3
> application/x-httpd-php3-source			phps
> application/x-httpd-php3-preprocessed 		php3p
> 
> in /etc/mime.types.

okay, here's another jab at it --

in the beginning, there was php. and it was good.

then they improved it and improved it.

so you gotta be able to distinguish between php, php3 and php4,
right? when i messed with it, apt-get removed php3 when i installed
php4, so that's pretty thorough when it comes to differentiating.

but checking out the /server-info report, i saw:
	Module Name:
		mod_php4.c 
	Content handlers:
		 application/x-httpd-php , application/x-httpd-php-source , text/html 
	Configuration Phase Participation:
		 Create Directory Config, Merge Directory Configs
	Request Phase Participation:
		 none

note the mime major/minor types? THAT is what your apache module is looking
for...

	$ grep 'php' /etc/apache/httpd.conf
	LoadModule php3_module /usr/lib/apache/1.3/libphp3.so
	AddType application/x-httpd-php3 .phtml
	AddType application/x-httpd-php3-source .phps

so my setup was goofy as well. i changed it to

	$ grep 'php' /etc/apache/httpd.conf
	LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
	AddType application/x-httpd-php .phtml
	AddType application/x-httpd-php-source .phps

(no *-php3*, just *-php*) and voila, suddenly all is sparkles:

	<? phpinfo(); ?> 

on *my* setup, any *.phtml file is treates as a 
	application/x-httpd-php
file because of the directive
	AddType application/x-httpd-php .phtml
in my httpd.conf file.

if i wanted it to treat any *.html file as php, i'd say
	AddType application/x-httpd-php .html
or i could just use bizarre codes of my own:
	AddType application/x-httpd-php .doh

or, use a <Location> directive like the cgi-bin directory does:

	<Location /p3>
		AddType application/x-httpd-php3 .
	</Location>

but the mime types you tell apache to look for hafta match
what the modules are expecting!

-- 
things are more like they used to be than they are now.

will@serensoft.com *** http://www.dontUthink.com/



Reply to: