I need to run a script that will execute a php file but I can't run the PHP file from Bash Script
Test.sh:
#!/bin/sh
php /home/username/public_html/Test3/Test.php
Where is the error?
/var/log/cron :
Sep 7 22:56:01 srv CROND[4344]: (root) CMD (sh /home/Username/public_html/Test3/test.sh)
Test.php
<?php
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$date = date('h:i:s');
$sql = "UPDATE deneme SET CRONTEST='".$date."' WHERE id=1";
$stmt = $conn->prepare($sql);
$stmt->execute();
echo $stmt->rowCount() . " records UPDATED successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
php -vin bash?xto file?