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" 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: References: 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: Xref: csiph.com comp.lang.php:10729 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 > > Warning: session_start() [ href='function.session-start'>function.session-start]: Cannot send > session cookie - headers already sent in > /home/twpalygj/public_html/Connections/gleanslo.php on line > 2
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 (). 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