(Possibly this belongs on stackoverflow, although it's not really a programming issue since the code works when run directly. If it needs to be moved, though, no problem.)
I have a PHP file (which consumers a National Weather Service web service via SOAP, if it matters) that I need to run on a scheduled basis. I'm trying to set up a cron
job in Webmin. If I use an absolute path to the file in the Command field, when I run it I get some strange errors:
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 1: ?php: No such file or directory
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 2: //: is a directory
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 3: //DOCUMENTATION: No such file or directory
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 4: //: is a directory
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 5: syntax error near unexpected token `"running client code",'
/var/www/html/mysite.com/test/ndfdXMLclient.php: line 5: `error_log("running client code", 1, "
[email protected]");'
The actual code in my file for those 5 lines looks like this:
<?php
// ***************************************************************************
//DOCUMENTATION FROM WEATHER.GOV ALL STORED IN xmlClientComments.txt
// ***************************************************************************
error_log("running client code", 1, "
[email protected]");
The code runs perfectly fine when I run it directly in my browser, so why doesn't webmin recognize it as code? (The same thing happens if I enter the actual URL in the command field - http://mysite.com/test/ndfdXMLclient.php.)
I've never worked with webmin before; most of our hosts' cron control panels allow cron jobs to run PHP files like this with no issue. Is there some trick to getting webmin to read php as actual php?