www.webdeveloper.com
Results 1 to 3 of 3

Thread: Cron job running php script with MySQL error

  1. #1
    Join Date
    Jul 2005
    Posts
    601

    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
    Location
    chennai, tamil nadu, India
    Posts
    445
    Can you post your cron line here ?
    Chris, Senior Developer,
    Php laravel developers,
    www.chrisranjana.com

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,338
    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

    eBookworm.us

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



Recent Articles