Jump to content

[SOLVED] crontab problem


ted_chou12

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.