I have in root folder of my joomla website a php where i load joomla framework and create a xml output file, the first lines before i do a db request are:
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', realpath(dirname(__FILE__)));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
If i run this file i get a well generated xml file, that's ok. but i need to set a cronjob for it, if i try to run cron job, i get this error message:
/PATH/my_file.php: line 1: ?php: No such file or directory
/PATH/my_file.php: line 2: syntax error near unexpected token `'_JEXEC','
/PATH/my_file.php: line 2: ` define( '_JEXEC', 1 );'
What i need to fix to get a correct cron job?