niwa3836 Posted November 10, 2007 Share Posted November 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/ Share on other sites More sharing options...
niwa3836 Posted November 10, 2007 Author Share Posted November 10, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-388695 Share on other sites More sharing options...
niwa3836 Posted November 10, 2007 Author Share Posted November 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-388723 Share on other sites More sharing options...
wildteen88 Posted November 10, 2007 Share Posted November 10, 2007 Why do you need to parse xml files with PHP for in the first place? Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-388776 Share on other sites More sharing options...
niwa3836 Posted November 10, 2007 Author Share Posted November 10, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-388793 Share on other sites More sharing options...
wildteen88 Posted November 11, 2007 Share Posted November 11, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-389069 Share on other sites More sharing options...
niwa3836 Posted November 11, 2007 Author Share Posted November 11, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/76772-solved-php5-and-apache-help-please/#findComment-389276 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.