Jump to content

Recommended Posts

Hi,

Have trawled and found answers to this but the options I do not have!

 

Basically I want the php engine to process ".php" files as well as ".xml" files

 

I have seen posts saying modify httd.conf in apache, but I dont have this line below.

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

 

 

I only have: -

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

PHPIniDir "C:/Program Files/PHP/"

LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

 

Any ideas on how I get PHP to process .XML as .php files please?

 

Please email me at phpfreak .a.t. nigelwarburton .d.o.t. co .d.o.t. uk THANKS

Link to comment
https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/
Share on other sites

Hum, Think I have solved this by adding in httd.conf

 

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">

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

 

</Directory>

 

Seems to have done the trick (although the rest of the code isnt working yet!)

 

Is this right?

Ok, so heres the next problem....

I am trying to get my php code to send back xml to an application that requires "xml". The php code now executes when the application calls the file.xml on my apache2.2 server, and apache responds. Problem is I think that the response says html/text as the content type. This is fine for all the other applications I respond with, but it appears not here. I need my apache to say the content is html/xml with a charset.

 

I have found an example below, but maybe I dont understand it..

It says to set this in httpd.conf (done and restarted):-

AddHandler type-map .var

 

Then create a .var file, I created dtxmlstats.var in the htdocs directory, alongside dtxmlstats.xml (php file with xml in it)

 

URI: dtxmlstats.xml

Content-type: text/xml;charset=iso-8859-1

 

Doesnt seem to work (have checked with wireshark) ... any ideas.

 

I got this information from http://httpd.apache.org/docs/2.0/content-negotiation.html

 

Long story...!

 

Basically Apache2.2 and PHP and the main components for a web application. I would like to extend the "application" to an xml device (phone).

 

So the plan was... use php to send print("<MENU>"); messages (i.e. XML ) to the phones, so I can provide a status to them too. I do this today (same app) to a device that requires VXML and that works. A have used a seperate application to capture a good XML converstation, against the bad one from php, and it appears that the only difference is the fact that php server responds with Content-type html/text where as the app that works responds html/xml, hence why I want to control the "output" from the apache2.2 web server so on some pages dished out it says html/text and some say html/xml.

 

The .var approach seems to be the right way, but I think I miss understand as ... it doesnt work :(

 

Any ideas / help. Does this make sense?

You can change the content type via PHP within your script eg:

header('Content-type: html/xml');

That line will need to the first line within your script. Make sure you don't have any output before you call that function.

Many thanks my man! I am a little silly as I should have thought about header as I currently use that for redirects. Still long days and I am not a programmer by trade!

 

Slight change is that it needed to be text/xml but that then worked fine.

 

Many thanks for your help

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.