Forum Moderators: phranque

Message Too Old, No Replies

AddType not working for PHP in CGI mode on Apache

Addtype to parse PHP in HTML

         

ion_admin

1:14 pm on Aug 27, 2006 (gmt 0)

10+ Year Member



Hello,

I am hosting my .net domain with AwardSpace which is a free webhost provider. I am also hosting my .com with GoDaddy and the support is really so excellent that I had to rely on experts here to solve my problem.

I have loads of html which have PHP code embedded in it. I use php in html to include various header and footer files. It is impossible for me to change all of these to .php now as I have many files.

One of the file http://www.example.com/admin/listmessages.html is not working while an exact copy in PHP extension http://www.example.com/admin/listmessages.php works.

This is the environment on GoDaddy.

.httpd.conf access and mofidication is not allowed.

.htaccess is allowed.

PHP runs in cgi mode.

I added this line in the .htaccess and I still get the PHP as it is without being parsed

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

I have searched the web, this forum and other engines and tried all possible combinations but it doesn't work.

AddHandler server-parsed .php .html - Doesn't work

RemoveHandler .html .htm

AddType application/x-httpd-php .php .htm .html - Doesn't work

Can someone please help? Thanks a ton for your directions.

Regards

iON Admin

[edited by: jatar_k at 2:35 pm (utc) on Aug. 27, 2006]
[edit reason]
[1][edit reason] no urls thanks [/edit]
[/edit][/1]

encyclo

2:10 am on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld ion_admin! I don't have any experience with PHP running in cgi mode, but have you tried the following:

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

jdMorgan

4:07 am on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




AddHandler server-parsed .php .html

Should have worked.

There's massive confusion in the "php world" about this, but AddType has to do with MIME_Types and AddHandler has to do with whether a file is to be executed or parsed by a program or interpreter on the server or simply sent to the client.

At some point, a kludge was added to Apache, but otherwise, "AddType x-application..." should have no effect on whether a file is parsed on the server. And if it is parsed on the server, then with that directive in force, its output should be sent to the client application for further processing with that MIME-type.

It looks like someone added a hack to make life easier, and this just led to a lot of confusion.

In short, if


AddHandler server-parsed .php .html

does not work, then you should contact your host.

Jim

ion_admin

7:59 pm on Aug 28, 2006 (gmt 0)

10+ Year Member



AddHandler application/x-httpd-php .php .html - Doesn't work.

When I add AddHandler server-parsed .php .html, both php and html are not parsed anymore :-(

I am also having a tough time convincing GoDaddy that this is not how it is supposed to work, and that something is wrong in their configuration, but they are not budging from their stereotype answer "We do not support for scripts". :-(

Regards
iON Admin

Caterham

8:36 pm on Aug 28, 2006 (gmt 0)

10+ Year Member



PHP in CGI mode

AddHandler application/x-httpd-php .php .html - Doesn't work.

Are you sure that application/x-httpd-php is the correct handler action-type from your corresponding Action directive?

henry0

8:46 pm on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try "I need my HTML to parse PHP" Since you do not support script will you for a fee do the edit?

If the answer is yes; then it could be done
and triggers:
A) they are too much $ focussed
B) Customer service is not the main concern

On a shared server it could be tough to get many
or any PHP.ini or HTTP.conf modif.

If you are not in programming and use only php to include a few files

why not doing the same includes with SSI

jdMorgan

9:02 pm on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Are you sure that application/x-httpd-php is the correct handler action-type from your corresponding Action directive?

Because application/x-httpd-php is a MIME-type, it is by definition, not an action type.

Here's another recent thread on a closely-related topic: [webmasterworld.com...]

The thread cited by coopster is a good one.

Jim

Caterham

12:46 pm on Aug 29, 2006 (gmt 0)

10+ Year Member



Because application/x-httpd-php is a MIME-type, it is by definition, not an action type.

Yes, if PHP is running as a module. But if you're running PHP as CGI you'd have sthg. like

ScriptAlias /php/ /usr/local/php5/bin/
Action xyz /php/php
AddHandler xyz .php

While you can use
Action application/x-httpd-php /php/php

but you needn't. You can also use xyz.