Cron job running php script with MySQL error
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:
If I run this directly on the db via Toad it runs fine, and also runs from the browser.
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>
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?
Many thanks in advance
Can you post your cron line here ?
You mysql_connect() failed.
"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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)