RHL7.0 and PHP4: Apache config file problem: file extensions

RHL7.0 and PHP4: Apache config file problem: file extensions

Post by Neil Zanell » Sun, 20 May 2001 13:37:57



The /etc/httpd/conf/httpd.conf file that comes with RHL7.0 contains the
following lines (see below). This is pointless as Red Hat 7.0 does not
install PHP/FI which is now outdated and does not install PHP3 either
but does install PHP4 which is broken up into the packages php-ldap,
mod_php, php, php-imap, php-mysql, php-pgsql, and php-manual. Hence
the PHP/FI and perhaps also the PHP3 lines should have been commented
out by the RPM spec file as I can now use .php3 extensions but not
.php or .php4 extensions for files to be correctly interpreted by the
Apache web server and I am not root on the system hence I cannot change
this. Has this problem been fixed in Red Hat 7.1?

Thanks!

# The following is for PHP4 (conficts with PHP/FI, below):
<IfModule mod_php4.c>
  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps
</IfModule>

# The following is for PHP3:
<IfModule mod_php3.c>
  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps
</IfModule>

# The following is for PHP/FI (PHP2):
<IfModule mod_php.c>
  AddType application/x-httpd-php .phtml
</IfModule>

 
 
 

RHL7.0 and PHP4: Apache config file problem: file extensions

Post by Christian Ros » Wed, 23 May 2001 00:05:40



> The /etc/httpd/conf/httpd.conf file that comes with RHL7.0 contains the
> following lines (see below). This is pointless as Red Hat 7.0 does not
> install PHP/FI which is now outdated and does not install PHP3 either
> but does install PHP4 which is broken up into the packages php-ldap,
> mod_php, php, php-imap, php-mysql, php-pgsql, and php-manual. Hence
> the PHP/FI and perhaps also the PHP3 lines should have been commented
> out by the RPM spec file as I can now use .php3 extensions but not
> .php or .php4 extensions for files to be correctly interpreted by the
> Apache web server and I am not root on the system hence I cannot change
> this.

I don't understand the problem. Why not just use the correct extensions,
or ask your system administrator to change the configuration to allow
your non-standard extensions?

How the extensions are handled depends on what apache modules are
present. If there is a php4 module, the php4 extensions are used. If
there is a php3 module, the php3 extensions are used. If that doesn't
work in your case you need to tweak your apache settings manually (but
usually you have to do that anyway). I don't see what's wrong with the
defaults.

Christian

 
 
 

1. Apache / PHP4 not serving .php files

I just upgraded my server (running Apache 1.3.12) to PHP4.0.2 ... now only
files with the extension .php3 are served. Files with extensions .php and
.php4 return 'HTTP 404 - File not found'?!?

I compiled PHP as a DSO, using the options --with-mysql --with-apxs

The following directives are present in httpd.conf:

# Extra Modules
LoadModule php4_module         modules/libphp4.so

# Extra Modules
AddModule mod_php4.c

# In Addtype - Mime Types
<IfModule mod_php4.c>
  AddType application/x-httpd-php .php .php3 .php4
  AddType application/x-httpd-php-source .phps
</IfModule>

2. Newbie proxy question

3. allow apache to copy files from /tmp to a file-directory under php4

4. netscape in X

5. Apache config: setting default file extension ?

6. Server runs somehow unstable

7. Custom file extensions with Apache/frontpage98 extensions

8. Whereis kman2html?

9. .htaccess Files / PHP4 and ErrorDocuments

10. PHP4 instructions do not work in HTML files

11. Problem with Apache + PHP4 DSO : symbol __muldi3: referenced symbol not found

12. Problem to compile Apache with mod_perl and PHP4 on AIX 5L

13. Help - Sending binary file by CGI (file extension problem in "i.e.")