- edited description
Cron Jobs - PHP Warning/Notices
Hi,
Using Piler 1.1.1 I'm getting PHP Warnings/Notices from the following Crojobs:
daily-report.php
PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30
PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30
PHP Warning: file_get_contents(/var/piler/stat/cpu.stat): failed to open stream: No such file or directory in /usr/libexec/piler/daily-report.php on line 108
PHP Notice: Undefined variable: ssize in /var/www/piler/model/stat/counter.php on line 20
PHP Notice: Undefined offset: 1 in /usr/libexec/piler/daily-report.php on line 125
PHP Notice: Undefined offset: 2 in /usr/libexec/piler/daily-report.php on line 126
PHP Notice: Undefined index: rcvd in /usr/libexec/piler/daily-report.php on line 128
generate_stats.php
PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30
PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30
Finished Executing Statistics Generation
*************************************************
Start Date: 2015.04.16
Stop Date: 2015.04.17
Removed 0 records
Added 0 records
Completed Run in 0.17446804046631 seconds
Thanks for looking into this.
Bye Frederik
P.S.: Are you merging PullRequest? Sometime ago I pushed pull request #3
Comments (24)
-
Account Deleted -
repo owner Hello Frederic, sorry, I overlooked your commit, I'll check it soon.
To solve these issues, apply the following diffs:
diff --git a/util/daily-report.php b/util/daily-report.php index 69af2bf..100c16e 100644 --- a/util/daily-report.php +++ b/util/daily-report.php @@ -5,6 +5,8 @@ $verbose = 0; $archivesizeraw = $sqlsizeraw = $sphinxsizeraw = 0; $averagemessagesweekraw = $averagemessagesmonthraw = $averagemessagesizeraw = $averagesizedayraw = $averagesqlsizeraw = $averagesphinxsizeraw = 0; + +ini_set("session.save_path", "/tmp"); $_SERVER['HTTP_USER_AGENT'] = "daily/cron"; @@ -122,8 +124,8 @@ $mail = new ModelMailMail(); $averagemessagesizeraw = $averagesqlsizeraw = $averagesphinxsizeraw = $daysleftatcurrentrate = 0; /* these next counters are for projecting space */ - $averagemessagesweekraw = ($processed_emails[1]) / 7; - $averagemessagesmonthraw = ($processed_emails[2]) / 30; + $averagemessagesweekraw = ($processed_emails['last_7_days_size']) / 7; + $averagemessagesmonthraw = ($processed_emails['last_30_days_size']) / 30; if($counters['rcvd'] > 0) { $averagemessagesizeraw = $archivesizeraw / $counters['rcvd']; @@ -175,8 +177,9 @@ $mail = new ModelMailMail(); $rcpt = array(ADMIN_EMAIL); - $x = $mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt, $msg); - + if(SMARTHOST) { + $x = $mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt, $msg); + }
diff --git a/util/generate_stats.php b/util/generate_stats.php index fd585e4..2f4ff1a 100644 --- a/util/generate_stats.php +++ b/util/generate_stats.php @@ -6,6 +6,8 @@ $start = NULL; $stop = NULL; $timestart = microtime(true); +ini_set("session.save_path", "/tmp"); + // get options from command line $opts = 'h::'; $lopts = array(
-
repo owner - changed status to resolved
-
Account Deleted Hi, unluckily it does not fix the warnings. In the
daily-report.php
there are 3 Lines less, but thegenerate_stats.php
is not changed.~$ /usr/bin/php /usr/libexec/piler/daily-report.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Notice: Undefined variable: ssize in /var/www/piler/model/stat/counter.php on line 20 PHP Notice: Undefined index: rcvd in /usr/libexec/piler/daily-report.php on line 130
~$ /usr/bin/php /usr/libexec/piler/generate_stats.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 ' Finished Executing Statistics Generation ************************************************* Start Date: 2015.04.26 Stop Date: 2015.04.27 Removed 0 records Added 0 records Completed Run in 0.02428412437439 seconds
-
Account Deleted - changed status to open
-
set the following in your php.ini
#! error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING
-
- marked as trivial
-
repo owner What version do you have? Is the gui version 1.1.1?
-
Account Deleted Yes, current stabke version.
-
repo owner I think something is not right on your side. "Undefined variable: ssize " says your tables are not updated. Check if the util/db-upgrade-xxxx.sql scripts were actually applied.
-
Account Deleted Hi,
it was a clean install of 1.1.1, so I initially executed the
db-mysql.sql
script.Also the
Undefined variable: ssize
comes from thememcached
acces. The_piler:size
key exists, but the_piler:counters_last_update
does not (see line 14 incounter.php
). Might that be a problem? -
repo owner Just fixed these scripts again. Please try them, this time try turning off memcache support.
-
repo owner - changed status to closed
No news is good news.
-
Account Deleted Sorry, I was onl holidays :-)
I tried the newest scripts from master/HEAD - no visible change.
With MEMCACHE disabled:
piler@mailarchive:~$ /usr/bin/php daily-report-new.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 piler@mailarchive:~$ /usr/bin/php generate_stats-new.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 Finished Executing Statistics Generation ************************************************* Start Date: 2015.05.21 Stop Date: 2015.05.22 Removed 0 records Added 0 records Completed Run in 0.039278030395508 seconds
With MEMCACHE enabled:
piler@mailarchive:~$ /usr/bin/php daily-report-new.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Notice: Undefined variable: ssize in /var/www/piler/model/stat/counter.php on line 20 PHP Notice: Undefined index: rcvd in /var/archiv/daily-report-new.php on line 130 piler@mailarchive:~$ /usr/bin/php generate_stats-new.php --webui /var/www/piler PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/piler/config-site.php:51) in /var/www/piler/system/request.php on line 30 Finished Executing Statistics Generation ************************************************* Start Date: 2015.05.21 Stop Date: 2015.05.22 Removed 0 records Added 0 records Completed Run in 0.083213090896606 seconds
BTW: What exactly is Memcache used for? Is it usefull to enable? (actually I just did it, since I couldn't find any deeper explanation in the docs).
Thanks a lot!
-
Account Deleted - changed status to open
sorry to reopen :-)
-
repo owner Please send me your config-site.php (obfuscate only passwords). See my email in piler -V
-
Account Deleted on its way
-
repo owner Thanks. Try removing the trailing ?> from the file, and let's see if it helps.
-
Account Deleted Arggggh... That on was too easy... Actually it works. Thanks!!!!
The Memcache related error persists: Should I just disable memcache?
-
repo owner There must have been an extra line at the end of the file. I could have thought about it sooner, indeed. I'll check the memcached related issue, until then you may disable it.
Btw. I've applied the init script fix recently (thanks for that anyway), though I didn't pull your your fork.
-
Account Deleted Thanks again!
-
repo owner Regarding the memcached problem, I think the daemon doesn't write the counters to memcached (but rather directly to the counter table), that's the reason of the missing variable.
Update model/stat/counter.php with this file: https://bitbucket.org/jsuto/piler/raw/b4867d79fe3d398b7f1a80603cc659be8f1cbcb8/webui/model/stat/counter.php and it will be ok now, regardless of the memcached settings.
-
repo owner - changed status to resolved
-
Account Deleted Thanks. Since it's just removing the memcache logic, it's working fine.
Done.... :-)
- Log in to comment