Pruusian Eka P
Pruusian Eka P

Reputation: 1

/bin/sh: 0: command not found

I have a following problem guys, my PHP script is like this:

#!/usr/bin/php
<?PHP

 // Define the path to file
 $file = 'mydb.sql';

 if(!file)
  {
    // File doesn't exist, output error
    die('file not found');
  }
  else
  {
    // Set headers
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: inline; filename=$file");
    header("Content-Type: application/x-sql ");
    header("Content-Transfer-Encoding: binary");

    // Read the file from disk
    readfile($file);
   }
?>

Now I want to call my PHP script via crontab, and my cron command is:

0 0 * * * /web/conf/ -q /home/content/81/10928381/html/dumper/work/backup/pr_download.php

But why, every time i run my script, it's always sent me an error message : /bin/sh: 0: command not found

Can you help me guys?

Thanks

Upvotes: 0

Views: 3012

Answers (3)

nl-x
nl-x

Reputation: 11832

what is /web/conf/? you are missing an executable command here... did you want wget ?

if you want to use your php executable instead, look where the executable is. eg /usr/sbin/php

then do

0 0 * * * /usr/sbin/php -f /home/content/81/10928381/html/dumper/work/backup/pr_download.php

Upvotes: 3

Eric Citaire
Eric Citaire

Reputation: 4523

I think I had the same error when trying to execute a Windows file (DOS format) as a script.

Try this :

dos2unix pr_download.php

and then try running your script again.

Let me know if it works.

Upvotes: 0

Faishal
Faishal

Reputation: 1493

try this

php -f /home/content/81/10928381/html/dumper/work/backup/pr_download.php  >> /tmp/script_log.log

Upvotes: 0

Related Questions