Patrick D
Patrick D

Reputation: 33

Launching Laravel 4 artisan command through Cron task

I'm new comer to Laravel 4 but not newbie for creating cron or using framework (codeIgniter / Yii, ...)

I set up an installation of Laravel 4, in my localhost and the same in my production web server.

When I launch a command via cron :

php -q path/to/laravel/artisan command:myspecificcommand or (same effect)
php -q path/to/laravel/artisan cache:clear

Then I obtain an Exception:

RuntimeException
Failed to start the session because headers have already been sent by "" at line 0.

It occurs in the vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

when I launch those commands in the console of MacOs all stuffs are achieved correctly. I use in my production server: php 5.3.13, there is a output_buffered set (I look for that due to the title of the error) but I'm completly stuck.

I give image of the result (there is the stack)

Upvotes: 3

Views: 1505

Answers (1)

JasonMortonNZ
JasonMortonNZ

Reputation: 3750

It often very much depends on your hosting and how they've got things set up. Each hosting company will have their own way of setting things up.

PHP CLI is the command line interface for PHP (e.g. for creating standalone applications). The CLI version is intended to run on a command line (hence "Command Line Interface"). This one does not handle headers, or any other server-related things.

Although not a duplicate of your question, you might find this helpful: What is difference between php cli and php cgi?

Upvotes: 3

Related Questions