Accessing Imagick from cron job
Accessing Imagick from cron job
I have a site running on a shared server account. I'm having an issue where I have code using imagick that works fine when initiated from a web page, but when that same code is initiated from a cron job I get a "Class 'Imagick' not found" error. I have extension="imagick.so" in the php.ini file in my account root folder, as well as in my site root folder. My hosting company spent some time looking everything over with me and cannot tell me why my cron job is unable to find imagick. I'm hoping someone here knows something about this scenario that would help.
Re: Accessing Imagick from cron job
What is your cron job code?
Will any other php cron job run?
Will any other php cron job run?
Re: Accessing Imagick from cron job
I have 7 cron jobs that all run from the same folder. The only issue is the one that uses imagick.
The cron job code:
include('/home/account/folder/config.php');
include('/home/account/folder/autoload.inc.php');
$DB = DB::dbConnection();
$Themes = new Themes();
$today = date('Y-m-d');
$dateexists = $Themes->getCalItems($today);
if ($dateexists) {
$Themes->activateTheme($dateexists['ThemeKey']);
}
The activateTheme method is used from one of the web pages as well as from the cron job. It works fine from the web page.
There are several functions that execute prior to utilizing imagick and everything runs fine from the cron job up to the point that I try to create a new instance of imagick. I get the error "Class 'Imagick' not found" on this line of code:
$image = new Imagick($filepath);
But again, this runs fine from the web page and only fails from the cron job.
The cron job code:
include('/home/account/folder/config.php');
include('/home/account/folder/autoload.inc.php');
$DB = DB::dbConnection();
$Themes = new Themes();
$today = date('Y-m-d');
$dateexists = $Themes->getCalItems($today);
if ($dateexists) {
$Themes->activateTheme($dateexists['ThemeKey']);
}
The activateTheme method is used from one of the web pages as well as from the cron job. It works fine from the web page.
There are several functions that execute prior to utilizing imagick and everything runs fine from the cron job up to the point that I try to create a new instance of imagick. I get the error "Class 'Imagick' not found" on this line of code:
$image = new Imagick($filepath);
But again, this runs fine from the web page and only fails from the cron job.