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
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
尝试这个
php -f /home/content/81/10928381/html/dumper/work/backup/pr_download.php >> /tmp/script_log.log
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.