• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

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

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

experts.zip
0
webguy62
Asked:
webguy62
  • 7
  • 7
1 Solution
 
Adam314Commented:
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.
0
 
webguy62Author Commented:
NEW:

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  
CGI::Carp



 OLD

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
0
 
Adam314Commented:
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"'
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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?
0
 
Adam314Commented:
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.
0
 
Adam314Commented:
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.
0
 
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" />
  </markers>


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
0
 
Adam314Commented:
The gsur_pl.txt from your zip file doesn't generate that XML, it generates an html page.
0
 
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.
 
http://www.simplechoicerealty.com/gdata.pl?siteid=chris&userid=680&search=yes&surid=5486136&radius=2&ptype=Commercial
 
The same code on old server gives the out put as XML file, like in the link below.whiich is what we need
 
http://carr.re-data.org/gdata.pl?siteid=chris&userid=680&search=yes&surid=5486136&radius=2&ptype=Commercial
 
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]
0
 
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
0
 
Adam314Commented:
attach your index.php file.
0
 
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

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

ini_set("memory_limit","64M");

//ini_set("display_errors","2");
//ERROR_REPORTING(E_ALL);

//print_r($_REQUEST);

include("includes/config.inc.php");
include(DIR_CLASSES."/global.class.php");

include(DIR_CLASSES."/clsMasterData.class.php");

include(DIR_CLASSES."/clsCurrentPage.class.php");
include(DIR_CLASSES."/clsBuildPanels.class.php");
include(DIR_CLASSES."/clsBuildHeader.class.php");
//include(DIR_CLASSES."/clsBuildFooter.class.php");
include(DIR_CLASSES."/clsDisplaySite.class.php");


if($_REQUEST['pageid'])
      $pageId = $_REQUEST['pageid'];
else
      $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,
                                                      $hdlSitePanels,
                                                      $hdlMasterData->arrSiteMasterData,
                                                      $hdlBuildHeader->headerImage,
                                                      $hdlBuildHeader->strMenu,
                                                      $hdlBuildHeader->strFooterMenu,
                                                      $hdlBuildHeader->pageFlashHeader,
                                                      $pageType,
                                                      $hdlBuildHeader->strVillaMenu,
                                                      $hdlCurrentPage->strVillaContent,
                                                      $hdlBuildHeader->strMultiLang,
                                                      $hdlBuildHeader->strDisplayTime
                                                      );

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

print $hdlDisplaySite->showHTML;

?>
config-inc-php.txt
0
 
Adam314Commented:

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

Open in new window

0
 
webguy62Author Commented:
it works  thanks big time...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now