don`t work preg_match on cron

Status
Not open for further replies.

aropan18

New Member
Messages
17
Reaction score
0
Points
0
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.
 

vv.bbcc19

Community Advocate
Community Support
Messages
1,524
Reaction score
92
Points
48
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.
 

aropan18

New Member
Messages
17
Reaction score
0
Points
0
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.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Without seeing the code for the script, there is no way of knowing what the problem is.
 

aropan18

New Member
Messages
17
Reaction score
0
Points
0
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;
 
Status
Not open for further replies.
Top