
24th May 2006, 15:38
|
|
Moderator
|
|
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
|
|
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
|

24th May 2006, 15:52
|
|
Junior Member
|
|
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

24th May 2006, 17:48
|
|
Moderator
|
|
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
|
|
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?
|

24th May 2006, 18:14
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
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>
|

24th May 2006, 18:17
|
|
Junior Member
|
|
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes, that looks a better solution than mine!
N...
Last edited by neil6179; 24th May 2006 at 18:20.
|

24th May 2006, 18:20
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
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 ^^
|

24th May 2006, 18:37
|
|
Moderator
|
|
Join Date: Dec 2005
Location: The Netherlands
Posts: 1,721
Thanks: 148
Thanked 98 Times in 91 Posts
|
|
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 :-)
|

24th May 2006, 20:25
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
good to hear
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 15:43.
|
Recent comments
2 hours 6 min ago
7 hours 54 min ago
9 hours 46 min ago
11 hours 31 min ago
15 hours 21 min ago
21 hours 6 min ago
21 hours 17 min ago
1 day 1 hour ago
1 day 7 hours ago
1 day 12 hours ago