Make sure those directories are writeable under whatever user ID your cron job runs as, and double check that that session.auto_start=Off as it might be configured in a separate php.ini file (i.e., for php-cli).
The “Session must be started before any output has been sent to the browser; output started in /0” message is probably because you’re printing messages.
Actually I have the same issue when running piwik unit tests on windows.
In particular, the integration file trunk\tests\integration\processed\test_apiGetReportMetadata__API.getProcessedReport_day.xml
is:
<?xml version="1.0" encoding="utf-8" ?>
<result>
<error message="Session must be started before any output has been sent to the browser; output started in /0" />
</result>
At this stage I’m not sure what is causing this, but will try to understand…
I checked in a fix for the headers already sent. The culprit is using php-cgi instead of php-cli. The changeset is http://dev.piwik.org/trac/changeset/3468 (note there’s a new file).
This is working now, but I don’t understand why since I execute unit tests from http in firefox. Is there a reason the changeset r3468 would have fixed this use case as well?