I am trying to run a PHP script from a cron job using cPanel.
The script pulls records from a database and creates a series of PDf's using mPDF. There are 600 records being created, with each taking approx 0.5 seconds, which is causing the browser to timeout, but other than this the script runs fine.
I understand I need to set a cron job to run this so the 30 seconds max execution time is not reached. I am on shared hosting so this cannot be changed.
I have set the cron job up and it appears to run the script but it fails when it tries to perform a MySQL database call:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/path/to/mysite/classes/DbConnect.class.php on line 72 <span> - : SELECT a.*, b.title AS make_name, c.title AS model_name, d.name AS seo_link FROM cm_car_detail a
INNER JOIN cm_car_detail_make b ON a.make = b.cd_make_id
INNER JOIN cm_car_detail_model c ON a.model = c.cd_model_id
INNER JOIN cm_page_settings d ON d.link_id=a.car_detail_id
WHERE a.active = 1 : [STOP]</span>
If I run this directly on the db via Toad it runs fine, and also runs from the browser.
My host has assured me that the MySQL will work from command line PHP and that others are using it so.
I am completly stumped, has anyone come across this before?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks