Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10729

Re: cron job and headers sent error

Path csiph.com!usenet.pasdenom.info!aioe.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: cron job and headers sent error
Date Sun, 08 Sep 2013 16:40:30 +0200
Lines 36
Message-ID <b93giuFgnkfU1@mid.individual.net> (permalink)
References <tduo29dbnp2l23rjvvol64iveibjup6189@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net JTc6geHM9LrKJtC6zutkAA+wKKFP1L7fqKk9HnYOeQnGV3FSfF
Cancel-Lock sha1:T+3jwFunvPFsQQU2RU1/xYK54s8=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130808 Thunderbird/17.0.8
In-Reply-To <tduo29dbnp2l23rjvvol64iveibjup6189@4ax.com>
Xref csiph.com comp.lang.php:10729

Show key headers only | View raw


On 08/09/13 15:36, Richard Yates wrote:
> 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 />

This is a warning you usually get when you have white spaces or bom 
sequence in your files. Check all your files that are used, that they do 
not have anything before or after the PHP tages (<?php and ?>).

As you are anyway running a cron job, why do you call it over tcp/ip?

I would recommend you to rewrite the cron job to just connect to the 
database and do it's job, do have error handling in the script which 
gives you proper explanations why something goes wrong if something does 
that. A good thing is also log to syslog so you can see the job has been 
properly done and you can also forward that to splunk or similar.

-- 

  //Aho

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

cron job and headers sent error Richard Yates <richard@yatesguitar.com> - 2013-09-08 06:36 -0700
  Re: cron job and headers sent error "J.O. Aho" <user@example.net> - 2013-09-08 16:40 +0200
    Re: cron job and headers sent error Richard Yates <richard@yatesguitar.com> - 2013-09-08 08:35 -0700
      Re: cron job and headers sent error "Peter H. Coffin" <hellsop@ninehells.com> - 2013-09-08 14:34 -0500
      Re: cron job and headers sent error "J.O. Aho" <user@example.net> - 2013-09-08 22:30 +0200
        Re: cron job and headers sent error Richard Yates <richard@yatesguitar.com> - 2013-09-08 13:42 -0700
        Re: cron job and headers sent error T0xicCode <t0xic@co.de> - 2013-09-08 22:21 -0400
  Re: cron job and headers sent error Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-08 21:09 +0000
    Re: cron job and headers sent error Richard Yates <richard@yatesguitar.com> - 2013-09-09 04:29 -0700

csiph-web