Jump to content

[SOLVED] Problem with htaccess or Apache, not sure which


Recommended Posts

I have this in an htaccess file with this in it

 

AddType application/x-httpd-php .xml

 

I have AllowOverride All set in my apache config file.

 

I am trying to set xml files to process as php for a dynamic rss feed.

 

Here is my code, and it does not work, not sure why.

 

<?php header('Content-type: text/xml'); ?>

<?php
require ("../includes/vital.php");
?>

<rss version="2.0">
<channel>
<title>peranha.dyndns.org</title>
<description>Peranhas Test Website</description>
<link>http://peranha.dyndns.org/</link>
<copyright>Copyright Peranha</copyright>

<?php
// open connection
$connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");


$query = "SELECT commid, subject, comment, datestamp, timestamp FROM feed ORDER BY commid DESC LIMIT 0,15";
$result = mysql_query($query) or die (mysql_error());

if (mysql_num_rows($result) > 0) {

while($row = mysql_fetch_row($result)) {
?>
     <item>
        <title> <?php echo htmlentities(strip_tags($row['1'])); ?></title>
        <description> <?php echo htmlentities(strip_tags($row['2'],'ENT_QUOTES')); ?></description>
        <link>http://peranha.dyndns.org/test.php?id=<?php echo $row['0']; ?></link>
        <pubDate> <?php echo $row['3'] . "  " . $row['4']; ?></pubDate>
     </item>  
<?php 
}

}

// close connection
mysql_close($connection);
?>  

</channel>
</rss>

 

If I save it as a php file, it will display fine.

 

PS, I have reset the apache server.

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.