SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem With Cron Triggering PHP Script

    I've got some CRON events setup to run which simply run a php script on my server which does some data scraping (Twitter API, Google API, etc..)

    The CRON is running the scripts at my desired times but I keep receiving emails from my server. When I try to run the scripts directly from shell (php myfile.php) I'm getting these errors:

    Code:
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
    
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/php_curl.dll' - /usr/lib/php/modules/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
    
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/php_mcrypt.dll' - /usr/lib/php/modules/php_mcrypt.dll: cannot open shared object file: No such file or directory in Unknown on line 0
    The code inside one of the files throwing this error:

    PHP Code:
    #!/usr/local/bin/php
    <?php


            define
    ('ga_email','--myconnectiondata--');
            
    define('ga_password','--myconnectiondata--');
            require 
    '../includes/top.php';
            require 
    '../includes/gapi.class.php';

            
    $ga = new gapi(ga_email,ga_password);

            
    $sql mysql_query("SELECT * FROM sys_google_profiles") or die(mysql_error());
            while(
    $row=mysql_fetch_array($sql)) {

                    
    // GET THE GOOGLE PROFILES FOR THIS CLIENT
                    
    $start_date date("Y-m-d"time() - (60*60*24));
                    
    $end_date date("Y-m-d"time() - (60*60*24));

                    
    $ga->requestReportData($row['ga_profile_id'],array('visitCount'),array('pageviews','visits'), nullnull$start_date$end_date);

                    
    $views $ga->getVisits();
                    
    $pageViews $ga->getPageViews();

                    
    mysql_query("INSERT INTO sys_google_stats (id, user_id, sys_google_profile, views, pageViews, `date`) VALUES ('', '".mysql_real_escape_string($row['user_id'])."', '".mysql_real_escape_string($row['id'])."', '".mysql_real_escape_string($views)."', '".mysql_real_escape_string($pageViews)."', '".mysql_real_escape_string($end_date)."')") or die(mysql_error());

            }


            
    ?>

    The scripts run FINE from browser.

    I'm running CENT OS.

    Thanks

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Are you cron'ing this from root?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  3. #3
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes


Bookmarks

Posting Permissions

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