grucker Posted May 11, 2010 Report Share Posted May 11, 2010 Downloaded wamp and loaded paypal web site for a refresher and site will not open xml. index.php is blank viewing page source shows php. Tried another php site and this shows perfectly. Any advice please ? Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 Tried wamp 5 and am getting Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\wamp\www\sitemap.php:2) in c:\wamp\www\mulberry\functions\functions.php on line 59 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\wamp\www\sitemap.php:2) in c:\wamp\www\mulberry\functions\functions.php on line 59 As I said earlier this all works on my web host. Just wondering if anyone has an idea what I can do. Thanks Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 The "headers already sent" error usually means that something was sent to display in the browser before you used session_start(). In most cases, this is because of an empty space before the opening <?php tag. I would check the top of your sitemap.php file -- make sure the first thing in the file is the <?php tag. Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 Thanks for looking, below is the code. As I said it works fine on my web server, just errors on wamp. Other files are the same Wondered if it was an Apache problem. Thanks <?php require_once 'mulberry/functions/functions.php'; $shopping_cart = get_shopping_cart(); ?> <?php $thisPage="sitemap"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="shortcut icon" href="http://www.ultimateskincare.org.uk/mulberry/images/ulticon.ico" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="google-site-verification" content="usM43MPT6eFkeFdZ8i6B4X7-06p12MKnakEYkOFqS5g" /> <title>Ultimate Skin Care:-<?php if ($thisPage!="") echo " | $thisPage |"; ?> featuring the skin care products of Poppy Red Naturals, Acamuti and Lavera</title> <meta name="robots" content="Index, ALL" /> <meta name="language" content="en" /> <meta name="keywords" content="<?php if ($thisPage!="") echo " | $thisPage |"; include("mulberry/includes/keywords.php"); ?>" /> <meta name="description" content="<?php if ($thisPage!="") echo " | $thisPage |"; include("mulberry/includes/keywords.php");?>" /> <link rel="stylesheet" href="mulberry/mulberry_styles.css" type="text/css" /> </head> <body> <?php include("mulberry/includes/indexheader.php"); ?> <?php include("mulberry/includes/rightlinks.php"); ?> <div id="leftpanelcontent"> <div style="float:left;"><img src="mulberry/images/ultimate3.png" alt="ultimate logo <?php include("mulberry/includes/keywords.php");?>" height="60" width="60"/> </div> <div style="float:right; padding-right:5px"><img src="mulberry/images/ultimate3.png" alt="lavera logo <?php include("mulberry/includes/keywords.php");?>" height="60" width="60"/> </div> <h3 style="text-align:center;margin:-10px 0 0 0;">Links To All The Pages On Our Site<br/> </h3> <div style="width: 475px;"> <br/> <?= render_products_from_SITEMAP() ;?> </div> <br/><br/><br/><br/><br/><br/><br/> <div id="various"> <p style="text-align:center; "><img src="mulberry/images/various.png" alt="green logo <?php include("mulberry/includes/keywords.php"); ?> " width="400" height="290" style="border: #6B003C solid 2px"/></p> </div> </div> <hr class="hidden" /> </div> <?php include("mulberry/includes/indexfooter.php"); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 Have you checked that the first character in the file is "<" (the start of the <?php tag)? Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 Yes the code is exactly the code I showed in previous post. The code is on line 1 and hard left, nothing before it. Thanks Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 What's around line 59 in c:\wamp\www\mulberry\functions\functions.php? That's the second place the error message mentions. Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 The following is the code starting on line 59. SESSION_START(); function get_xml_sitemap() {return new SimpleXMLelement(file_get_contents(STORE_XML_SITEMAP_FILE));} This code is on line 4 Thanks define('STORE_XML_SITEMAP_FILE' , ($_SERVER['DOCUMENT_ROOT'] .'/sitemap.xml')); Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 Any idea why your session_start() is semi-randomly in the middle of that file? I'd suggest moving it either to the beginning of sitemap.php (but you'll need to update all of your files that use the session to include the session_start at the beginning of the file): <?php session_start(); require_once 'mulberry/functions/functions.php'; Or make it the first line within the functions.php file: <?php session_start(); // rest of code here... Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 Tried both ways with the same result. The warnings disappear and the page loads except no links from the xml file. In the page source it says in a pale purple. <?= render_products_from_SITEMAP() ;?> Thanks Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 Ah, right. OK. Two things: You need to add session_start() to the beginning of your functions.php file like I showed you above. Secondly, you need to change any instances of <?= $variable or function; ?> to <?php echo $variable or function; ?> In the most recent versions of PHP, the short syntax, "<?= ?>" which the parser used to translate into "<?php echo ?>" has been depreciated, and you should no longer use it. The video may have shown the short syntax, but it was recorded before this change with PHP occurred. Quote Link to comment Share on other sites More sharing options...
grucker Posted May 13, 2010 Author Report Share Posted May 13, 2010 Thats it, thanks very much. Has this only just been deprecated cause it worked fine a few months ago when I did the video? Thanks again. David Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 13, 2010 Report Share Posted May 13, 2010 I'm not exactly sure when that changed -- I'd need to do some research -- but I believe it was in a recent update to PHP5. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.