FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » cron job and headers sent error
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
cron job and headers sent error [message #182767] Sun, 08 September 2013 13:36 Go to previous message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma:
Member
I have a script that runs automatically every night that shortens some
tables. It has been working fine (Actually still is doing what it is
supposed to). However I started getting an email warning notice when
it runs. In says headers have already been sent in line two of the
database Connection script that is included. I cannot figure out how
anything is being sent. The connection script does not output
anything. Line 2 identifies whether the script is running on the local
or production server. Any ideas where the error is coming from? Here
are the warning message, the cron script and the included connection
script:

-------- warning notice

<b>Warning</b>: session_start() [<a
href='function.session-start'>function.session-start</a>]: Cannot send
session cookie - headers already sent in
<b>/home/twpalygj/public_html/Connections/gleanslo.php</b> on line
<b>2</b><br />

------- cronjobs/cron.php

<?php
// site maintenance. shortens various database tables daily
require_once('../public_html/Connections/gleanslo.php');
require_once('../public_html/includes/dencode.inc.php');
// truncate mailarchive to last month
$prevdate= date('Y-m-d', strtotime("-30 days"));
$query="delete from mailarchive where whensent<'$prevdate'";
$rsQuery=mysqli_query($gleanslo, $query);
// truncate loginlog to last week
$prevdate= date('Y-m-d', strtotime("-7 days"));
$query="delete from loginlog where datein<'$prevdate'";
$rsQuery=mysqli_query($gleanslo, $query);
?>

------- Connections/gleanslo.php

<?php if(!isset($_SESSION)) session_start();
if($_SERVER["SERVER_NAME"] == "localhost" && $_SERVER["SERVER_ADDR"]
== "127.0.0.1") {
// on local server
$hostname_gleanslo = "localhost";
$database_gleanslo = "gleanslo";
$username_gleanslo = "root";
$password_gleanslo = "********";
} else {
// on production server
$hostname_gleanslo = "localhost";
$database_gleanslo = "twpalygj_gleanslo";
$username_gleanslo = "twpalygj_dyates";
$password_gleanslo = "********";
}
$gleanslo = mysqli_connect($hostname_gleanslo, $username_gleanslo,
$password_gleanslo, $database_gleanslo);
date_default_timezone_set('America/Los_Angeles');
$queryt="set time_zone='-8:00'";
$rsTime=mysqli_query( $gleanslo, $queryt);
// get all custom variables to insert into pages
if(!isset($_SESSION['custom']) or isset($_GET['ed'])) {
$cusquery="select * from custom";
$rsCustom=mysqli_query($gleanslo,$cusquery);
$orgrow=mysqli_fetch_assoc($rsCustom);
$_SESSION['custom']=$orgrow;
} // end of isset session custom
$orgrow=$_SESSION['custom'];
?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Mac OS X ML] how to install MongoDB driver
Next Topic: Trouble-shooting a script that doesn't retuen HTML
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 19:17:46 GMT 2024

Total time taken to generate the page: 0.04156 seconds