Why is crontab giving "No such file or directory" error when the file DOES exist?
Posted
by
fettereddingoskidney
on Server Fault
See other posts from Server Fault
or by fettereddingoskidney
Published on 2012-06-22T13:11:18Z
Indexed on
2012/06/22
15:18 UTC
Read the original article
Hit count: 278
I am getting the following three lines in an error message in /var/mail/username after the following job runs in crontab...
15 * * * * /Applications/MAMP/htdocs/iconimageryidx/includes/insertPropertyRESI.php
Errors:
/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.php: line 1: ?php: No such file or directory
/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.php: line 3: syntax error near unexpected token `'initialize.php''
/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.php: line 3: `require_once('initialize.php');
The PHP script I am trying to execute DOES in fact exist, and I have made absolutely sure the spelling is correct several times. I ran a crontab on another script before and it worked just fine...any ideas??
The 2nd & 3rd Errors are from line 3 in the following script (the one I am trying to run with the crontab):
<?php
require_once('initialize.php');
require_once('insertPropertyTypes.php');
$sDate;
if(isset($_GET['startDate'])) {
$sDate = $_GET['startDate'];
} else {
$sDate = '';
}
$insertResi = new InsertPropertyTypes('Listing', $sDate, 'RESI');
?>
When I run my script insertPropertyRESI.php in the browser, it runs just fine???? Also, initialize.php and insertPropertyTypes.php are in the same directory as insertPropertyRESI.php
I am using MAMP with PHP 5.3.5
thakns for the help :?
© Server Fault or respective owner