Nyxynyx
Nyxynyx

Reputation: 63687

"Constant CRLF already defined" error when using php-resque with Laravel

I'm running php-resque together with Laravel 3 on Ubuntu 12.04.

Problem: When a job is enqueued in resque, I get the following error:

Unhandled Exception

Message:

Constant CRLF already defined
Location:

/var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10

What does the error mean and how can we solve it?

PHP

// Enqueue in Resque        
$data = array(
    'name'                  => $name,
    'email'                 => $email,
    'created_at'            => DB::raw('NOW()')
);
Resque::enqueue('queue', 'exampleWorker', $data);

However when I try to enqueue a job using artisan, it works!

Task

class Queue_Task
{
    public function run()
    {
        // Autoload composer vendors.
        require path('composer').DS.'autoload.php';

        $args = array('name' => 'John Smith');
        Resque::enqueue('MyAppName', 'ExampleWorker', $args);

        echo "Resque job queued.\n";
        return;
    }
}

Output

PHP Notice:  Constant CRLF already defined in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10

Notice: Constant CRLF already defined in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10
Resque job queued.

Upvotes: 0

Views: 866

Answers (1)

Sammitch
Sammitch

Reputation: 32272

It's a guess, but I'd say in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php there's a second define('CRLF', 'something') on line 10 that should probably be commented out if you want these two pieces of software to work together.

Upvotes: 1

Related Questions