Closed Thread
Results 1 to 5 of 5

Thread: don`t work preg_match on cron

  1. #1
    aropan18 is offline x10Hosting Member aropan18 is an unknown quantity at this point
    Join Date
    Jun 2011
    Posts
    17

    don`t work preg_match on cron

    When i run "http://clist.x10.mx/update.php" through browser syntax (?<name>) for regular expression normally work, but when run with cron "/usr/bin/php -f /home/aropan/public_html/update.php" don`t work. Why? PHP script run on cron less 5.2.2 version?

    Thanks in advance.

  2. #2
    vv.bbcc19's Avatar
    vv.bbcc19 is offline Community Advocate vv.bbcc19 is just really nice
    Join Date
    Jun 2010
    Location
    India
    Posts
    1,505

    Re: don`t work preg_match on cron

    You can capture a cronjob output into a file so that you would know what exactly happend.
    This is how it could be done.
    For example,to Run job1 every 10 minutes (except on the hour), job2 on the hour (except at midnight), job3 at midnight (except Monday) and job4 at midnight on Monday, capturing output:

    10-50/10 * * * * $HOME/bin/job1 >> $HOME/log/jobs.txt 2>&1
    0 1-23 * * * $HOME/bin/job2 >> $HOME/log/jobs.txt 2>&1
    0 0 * * 0,2-6 $HOME/bin/job3 >> $HOME/log/jobs.txt 2>&1
    0 0 * * Mon $HOME/bin/job4 >> $HOME/log/jobs.txt 2>&1


    Just capture the output and you would know what happend.
    BCV | Community Support Representative
    █ x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  3. #3
    aropan18 is offline x10Hosting Member aropan18 is an unknown quantity at this point
    Join Date
    Jun 2011
    Posts
    17

    Re: don`t work preg_match on cron

    cron command "/usr/bin/php -f /home/aropan/public_html/update.php >> /home/aropan/public_html/cron.log 2>&1" create empty file cron.log, but i not have problem with execute script, i have problem no work syntax (?<name>) for regural expression in php when run cron, but run by browser all work. Thanks for configurate cron.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: don`t work preg_match on cron

    Without seeing the code for the script, there is no way of knowing what the problem is.
    Nothing is always absolutely so.

  5. #5
    aropan18 is offline x10Hosting Member aropan18 is an unknown quantity at this point
    Join Date
    Jun 2011
    Posts
    17

    Re: don`t work preg_match on cron

    this work only through browser:
    Code:
    if (!preg_match('#<a href="(?<url>[^"]*)" class="prevNext">next &gt;</a></strong>#', $page, $match)) break;
    this work and on cron too:
    Code:
    if (!preg_match('#<a href="([^"]*)" class="prevNext">next &gt;</a></strong>#', $page, $match)) break;

Closed Thread

Similar Threads

  1. not work cron jobs
    By sergunik48 in forum Free Hosting
    Replies: 3
    Last Post: 08-27-2010, 09:50 AM
  2. Cron jobs don't work.
    By gh00st in forum Free Hosting
    Replies: 1
    Last Post: 06-11-2010, 10:11 AM
  3. CRON JOB does not work
    By SharkyLV in forum Free Hosting
    Replies: 5
    Last Post: 04-21-2010, 04:09 PM
  4. Cron does not work on lotus
    By kote007 in forum Programming Help
    Replies: 0
    Last Post: 11-14-2009, 10:11 AM
  5. Cron don't work
    By alamar77 in forum Programming Help
    Replies: 1
    Last Post: 11-13-2009, 11:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers