Perl outputs html instead of xml on new server (Cache-Control: no-store, no-cache, must-revalidate)

I have attached output of on both servers, script causing problems and the correct output on old server and also the html output on new server.

 This is only differerence I can see on new server  is this line beside the OS and 64bit and LWP : v5.803  on old and  LWP : v5.805 on new

is this line of perl test
"& /etc/httpd"

What is the remedy???
see attached perl scripts, output generated on both servers and the output of on both servers
 this is the extra code that is produced in perl output on new server
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Type: text/xml; charset=ISO-8859-1 "

Open in new window
Who is Participating?
Adam314Connect With a Mentor Commented:

header('Content-type: text/xml');   #New line
print $hdlDisplaySite->showHTML;    #existing line

Open in new window

What version of the CGI module are you using on both servers?  What webserver are you using on both servers?

The extra text isn't part of the XML, it's part of the HTTP protocol.
webguy62Author Commented:

Operating system Centos 5  

Perl : v5.008008
httpd 2.2.3-11.el5_2.centos.4  
mod_perl 2.0.2-6.3.el5  
mysql 5.0.45-7.el5  


OS Fedora
httpd 2.0.54-10.4  
mod_perl 2.0.1-1.fc4  
mysql 4.1.20-1.FC4.1  
Perl : v5.008006
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Check the CGI module version with this (notice the use of single and double qoutes... you should cut/paste to get it exactly):
    perl -MCGI -e 'print "$CGI::VERSION\n"'
webguy62Author Commented:
new 3.15
old 3.10

I have fuidn some changes in apache 2.2 vs 2.0  but none that wil affect this script?
How did you generate the files in the zip file?  The gsur_pl.txt script does not appear to have generated any of the attached files.
It appears that you are using $USERID to manage a session.  If this is the case, you should consider using the CGI::Session module, which makes session management very easy.

Also, you might want to consider using one of the template modules designed for HTML.
webguy62Author Commented:
thje gsur_pl.txt generates  this xml which is good - <markers>
  <results count="3" longitude="-75.953813333333" latitude="39.800456333333" />
  <marker i="0" lat="39.803396" lng="-75.955323" id="5486136" price="1,200.0" city="OXFORD" property_type="Commercial" beds="" baths="OneBath" address="247 REEDVILLE" ph="1" />
  <marker i="1" lat="39.800474" lng="-75.954889" id="5483128" price="375,000.0" city="OXFORD" property_type="Commercial" beds="" baths="" address="1895 BALTIMORE" ph="0" />
  <marker i="2" lat="39.797499" lng="-75.951228" id="5332915" price="1,900,000.0" city="OXFORD" property_type="Commercial" beds="" baths="" address="355 REEDVILLE" ph="10" />

but on new server with newer verions of apache it adds this text at the top of output  

Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Type: text/xml; charset=ISO-8859-1
The gsur_pl.txt from your zip file doesn't generate that XML, it generates an html page.
webguy62Author Commented:
exacty and this is the problem. but on our old server it did genrate an xml page.     What do we need to do to change ti so it generates an xml on new server?

 see example links of 2 different servers exectuing same script.    We found that when "RewriteEngine on" is on in htaccess the perl script gives error of access denied. when rewrite rule is set to off we dont get  access denied error. but the output of the perl file is not proper, the file headers are not correct.
like in the link below. This file gives html output instead of xml.
The same code on old server gives the out put as XML file, like in the link below.whiich is what we need
We tried to make the rewrite rule and perl script work together but still the output is not proper.

below is rewrite rule for new server
RewriteCond %{REQUEST_URI} !^\/?(js|scripts|wysiwyg|design_demo|midas|map|api).*$

RewriteCond %{REQUEST_URI} !^\/?(map|api|admin).*$
RewriteRule   ^([0-9A-Za-z\_-]*)/([0-9A-Za-z\ \_-]*)/?$ index.php?pageid=$1&value=$2 [NS,QSA,L,PT] [E=UID:$1]
RewriteCond %{REQUEST_URI} !^\/?(map|api|admin).*$
RewriteRule   ^([0-9A-Za-z\_\/-]*)(/|\.html|/index\.html|/index\.htm)?$ index.php?pageid=$1 [NS,QSA,L,PT] [E=UID:$1]
webguy62Author Commented:
In other words this same gsur_pl.txt gives us different out put on 2 different servers. WE need it to give us  xml resutls on new server :)  the new server has newer version of apache and cgi as noted in past remarks.  I could not find anything in apache changes that would cause this
attach your index.php file.
webguy62Author Commented:
below is index.php and I think I know where you are going with this so I inclulded the config file as an upload

# File Name: includes/index.php    
# Index file for the user site, this will render full view of the site







      $pageId = $_REQUEST['pageid'];
      $pageId = '2';

/*---------------------------Load master data------------------------------*/

$hdlMasterData = new clsMasterData($hdlDb,$pageId);
$pageType = $hdlMasterData->arrSiteMasterData['pageType'];

/*---------------------------Built current page------------------------------*/
$hdlCurrentPage = new clsCurrentPage($hdlDb, $pageId, $hdlMasterData->arrSiteMasterData);

/*---------------------------Built panels ------------------------------*/
$hdlBuildPanels = new clsBuildPanels($hdlDb, $pageId);

/*---------------------------Built header ------------------------------*/
$hdlBuildHeader = new clsBuildHeader($hdlDb,$pageId);

/*---------------------------Built Footer ------------------------------*/

/*---------------------------Built Template ------------------------------*/
#$hdlSitePanels['left'] = $hdlBuildPanels->fnGeneratePanels("left");
#$hdlSitePanels['right'] = $hdlBuildPanels->fnGeneratePanels("right");  

$hdlDisplaySite = new clsDisplaySite($hdlDb,$hdlCurrentPage->strPageContent,

/*---------------------------Display Template ------------------------------*/

print $hdlDisplaySite->showHTML;

webguy62Author Commented:
it works  thanks big time...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.