Results 1 to 3 of 3

Thread: Cron job running php script with MySQL error

  1. #1
    Join Date
    Jul 2005

    Cron job running php script with MySQL error

    Hi All

    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?

    Many thanks in advance

  2. #2
    Join Date
    May 2004
    chennai, tamil nadu, India
    Can you post your cron line here ?
    Chris, Senior Developer,
    Php laravel developers,

  3. #3
    Join Date
    Aug 2004
    You mysql_connect() failed.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center