ted_chou12 Posted April 15, 2007 Share Posted April 15, 2007 Why is it when I am trying to let the crontab to run this file, this: crawler.php: line 1: syntax error near unexpected token `(' crawler.php: line 1: `<?php $files = file("links/db.txt");' shows up? line 1 of that file looks like this: <?php $files = file("links/db.txt"); thanks Ted Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/ Share on other sites More sharing options...
ted_chou12 Posted April 15, 2007 Author Share Posted April 15, 2007 please have a look at my problem. thanks. Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-229859 Share on other sites More sharing options...
ted_chou12 Posted April 15, 2007 Author Share Posted April 15, 2007 bump~.... Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-229965 Share on other sites More sharing options...
ted_chou12 Posted April 16, 2007 Author Share Posted April 16, 2007 bump~.... Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-230224 Share on other sites More sharing options...
PC Nerd Posted April 16, 2007 Share Posted April 16, 2007 um, put the tages on one line, and the codeon the next check which line the error is on then. ive had code, thwere the code before the tages, was causing the error Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-230226 Share on other sites More sharing options...
btherl Posted April 16, 2007 Share Posted April 16, 2007 Did you run 'script.php' from crontab, or 'php script.php' ? Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-230233 Share on other sites More sharing options...
ted_chou12 Posted April 16, 2007 Author Share Posted April 16, 2007 when I tried: <?php $files = file("links/db.txt"); The error becomes: crawler.php: line 1: ?php: No such file or directory crawler.php: line 2: syntax error near unexpected token `(' crawler.php: line 2: `$files = file("links/db.txt");' The path that I entered to the crontab is something like: /home/username/directories/crawler.php Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-230241 Share on other sites More sharing options...
ted_chou12 Posted April 16, 2007 Author Share Posted April 16, 2007 can anyone have a look at my problem? it's still unsolved. Ted Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-230588 Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 bump~... Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231046 Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Share Posted April 17, 2007 Ok firstly what are you try to do? run a text file using cronjobs? 2nd. Whats the full php code? Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231056 Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 this is surely a php file with the name "crawler.php", and i believe pasting the whole code is useless before even solving the problem of the first line. Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231109 Share on other sites More sharing options...
grlayouts Posted April 17, 2007 Share Posted April 17, 2007 well the first problem your gonna face is that if we don't know fully what you want how can we help. yes it doesn't work we know but what are you trying to do, open the file to do what? we need a sample code or something relating to a problem not just the small bit thats wrong. Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231116 Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 I am trying to store html codes of all the pages in my site, so this script has to be run everyday, in order to update those pages. If anyone can point out what the syntax for the first line might mean, I may try to solve by myself. But the problem is I dont understand what the "syntax error near unexpected token `('" means, so I am facing some problem, I already searched it in google, but the results arent very related to what i am looking for. Ted Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231148 Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 bumping hard... Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231626 Share on other sites More sharing options...
trq Posted April 17, 2007 Share Posted April 17, 2007 As has been asked (by betherl) and ignored... Did you run 'script.php' from crontab, or 'php script.php' ? If the first, you need to make your first line.... #!/usr/bin/php In order for the shell to know what interpreter is needed to run the file. Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231637 Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 I used the wizard, please see the attached picture, I dont know if that is how you enter the path to the php file in cron tab. The path is "Path to PERL /usr/bin/perl" Thanks Ted [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231644 Share on other sites More sharing options...
trq Posted April 17, 2007 Share Posted April 17, 2007 Just add the line I suggested and see if it works. Link to comment https://forums.phpfreaks.com/topic/47090-solved-crontab-problem/#findComment-231646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.