Hi I've installed and configured Gearman. So far it has been great trying out examples, and when I came to the part where I am actually going to use it in my project, that's where my problem began.
I'm using Yii php framework in my project, and I included all my worker files in the main project directory.
ProjectName/workers/worker.php
My workers' function are to insert values in the database given a parameter. So I had to include sql query, and since i'm using Yii, I use the :
Yii::app()->db->createCommand($sql)->execute();
and I encounter the error :
PHP Fatal error: Class 'Yii' not found in /home/user/lappstack-5.4.34-0/apache2/htdocs/ProjectName/workers/worker.php on line 52
It seems that my CLI PHP cannot find Yii, so I tried doing it old school using PDO :
$db = new PDO('pgsql:db...........'usr','pas');
$stmt = $dbh->prepare($sql);
$stmt->execute();
and I get the error :
PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /home/user/lappstack-5.4.34-0/apache2/htdocs/ProjectName/workers/worker.php:54
So it seems that the worker basically doesn't have a server environment unlike my web application that can access Yii functions and what not. How do resolve this?