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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted April 15, 2007 Author Share Posted April 15, 2007 bump~.... Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted April 16, 2007 Author Share Posted April 16, 2007 bump~.... Quote Link to comment 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 Quote Link to comment 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' ? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 bump~... Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted April 17, 2007 Author Share Posted April 17, 2007 bumping hard... Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.