0
我曾與此評論做一個cron作業: 「/home/username/public_html/cron.php」計劃作業PHP腳本錯誤
我的PHP(cron.php)
<?php
$server = 'localhost';
$user = 'name';
$pass = 'password';
$dbname = 'dbname';
$conn = new mysqli($server, $user, $pass, $dbname);
$sql = "Update table;";
$conn->query($sql);
$conn->close();
?>
這是錯誤:
/home/username/public_html/cron.php: line 1: ?php: No such file or directory
/home/username/public_html/cron.php: line 3: =: command not found
/home/username/public_html/cron.php: line 4: =: command not found
/home/username/public_html/cron.php: line 5: =: command not found
/home/username/public_html/cron.php: line 6: =: command not found
/home/username/public_html/cron.php: line 8: syntax error near unexpected token `('
/home/username/public_html/cron.php: line 8: `$conn = new mysqli($server, $user, $pass, $dbname);'
任何人都可以幫助解決這個問題嗎?謝謝。
shell不知道如何解釋PHP代碼。使用php解釋器和/或shebang。 – mario