'PHP cron job and php mail() function

I have a simple PHP script in a directory beta/cron/cron.php to send out mail as follows:

<?php

$to = "[email protected]";
$subject = "test subject";
$message = "test message";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: [email protected]" . "\r\n";

$result = mail($to,$subject,$message,$headers);
echo $result;

?>

If I got to this file in my browser everything works and the mail is sent/received.

However I want to set this up to run as a cron job but I get an error email instead from my hosts Cron Daemon address with the following:

Status: 404 Not Found
X-Powered-By: PHP/7.0.27
Content-type: text/html; charset=UTF-8

No input file specified.

My cron job is as follows:

* * * * * php beta/cron cron.php

My hosting company is register365.com and I think the SMTP is set up correctly but cannot figure out if there are logs for this somewhere or what might be causing this issue.



Solution 1:[1]

Thanks to @FMK and @B.Desai,

changing it to public_html/beta/cron/cron.php worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paddy Hallihan