#1  
Old 24th May 2006, 15:38
edge edge is online now
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
Default PHP generating XML

Hi all,

I've got this small PHP script that will generate a XML output from a MySQL.
When I call the 'make.php' file it does show a nice XML output.

How do I get this script to listen to a .XML request instead of a .PHP one?
Do I need to add something in my .htaccess file?

example:
mydomain.tld/make.php does work and generate a xml output from my MySQL on screen.
mydomain.tld/make.xml does not work (as there is no .xml file)

System I'm trying this on is CentOS using PHP 4.3.10
Reply With Quote
  #2  
Old 24th May 2006, 15:52
neil6179 neil6179 is offline
Junior Member
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm afraid I've not done this on CentOS using PHP 4.3.10, but on SuSE with Apache 2 you'd just need to add the following line into Apaches PHP config file (/etc/apache2/conf.d/php5.conf):

AddType application/x-httpd-php .xml

Apache will then just treat all files with the .xml extention as a PHP script.

Hope this helps...

Neil
Reply With Quote
  #3  
Old 24th May 2006, 17:48
edge edge is online now
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
Default

Quote:
Originally Posted by neil6179
Hi,

I'm afraid I've not done this on CentOS using PHP 4.3.10, but on SuSE with Apache 2 you'd just need to add the following line into Apaches PHP config file (/etc/apache2/conf.d/php5.conf):

AddType application/x-httpd-php .xml

Apache will then just treat all files with the .xml extention as a PHP script.

Hope this helps...

Neil
Hello Neil,

I do have a AddType application/x-httpd-php .php in my php.ini file.
Can I (if it works) just add .xml after the .php, or do I need to make a new linke?

AddType application/x-httpd-php .php .xml or a new line with only AddType application/x-httpd-php .xml

I guess I will also need to restart Apache after this?
Reply With Quote
  #4  
Old 24th May 2006, 18:14
sjau sjau is offline
Pseudo Lawyer
 
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
Default

I'd rather use a .htaccess entry, otherwise every xml is being parsed as PHP...

The .htaccess could look like this

Code:
<Files *xml>
        ForceType application/x-httpd-php
</Files>
Reply With Quote
  #5  
Old 24th May 2006, 18:17
neil6179 neil6179 is offline
Junior Member
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, that looks a better solution than mine!

N...

Last edited by neil6179; 24th May 2006 at 18:20.
Reply With Quote
  #6  
Old 24th May 2006, 18:20
sjau sjau is offline
Pseudo Lawyer
 
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
Default

Neil, you're solution definitively works... I'm not 100% sure about how to specify the files... I think *xml is ok but as said, not 100% sure ^^
Reply With Quote
  #7  
Old 24th May 2006, 18:37
edge edge is online now
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
Default

Quote:
Originally Posted by sjau
I'd rather use a .htaccess entry, otherwise every xml is being parsed as PHP...

The .htaccess could look like this

Code:
<Files *xml>
        ForceType application/x-httpd-php
</Files>
Thanks.. That did the trick :-)
Reply With Quote
  #8  
Old 24th May 2006, 20:25
sjau sjau is offline
Pseudo Lawyer
 
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
Default

good to hear
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"unknown filter" growing apache log. wwparrish Installation/Configuration 6 1st September 2006 19:40
Questions in regards to ISP-Server Setup - Ubuntu 5.10 "Breezy Badger" rbrantley HOWTO-Related Questions 16 10th April 2006 19:26
Downgrade php5 to php4.4.2 llizards Installation/Configuration 4 14th March 2006 00:58
all my site go to /var/www/ Absolusteph Installation/Configuration 14 11th March 2006 22:27
Sharedip Ivan Installation/Configuration 3 7th December 2005 16:36


All times are GMT +2. The time now is 15:43.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Sponsored Links: Unified Communications: Thoughts, Strategies and Predictions
Join the discussion.
www.seamlessenterprise.com

IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com

Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com

Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com

Red Hat Virtual Experience - a free virtual event. Dec. 9th