[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


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

Posted on 2009-05-07
Medium Priority
Last Modified: 2012-05-06
I have attached output of test.pl 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 test.pl 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

Question by:webguy62
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
LVL 39

Expert Comment

ID: 24329661
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.

Author Comment

ID: 24330049

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
LVL 39

Expert Comment

ID: 24330592
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"'
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 24330883
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?
LVL 39

Expert Comment

ID: 24332905
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.
LVL 39

Expert Comment

ID: 24333009
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.

Author Comment

ID: 24333135
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
LVL 39

Expert Comment

ID: 24336694
The gsur_pl.txt from your zip file doesn't generate that XML, it generates an html page.

Author Comment

ID: 24337046
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]

Author Comment

ID: 24337136
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
LVL 39

Expert Comment

ID: 24338973
attach your index.php file.

Author Comment

ID: 24339146
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;

LVL 39

Accepted Solution

Adam314 earned 2000 total points
ID: 24339336

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

Open in new window


Author Closing Comment

ID: 31579115
it works  thanks big time...

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question