Jump to content

WAMP


grucker

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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'));

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...