I'm making a Cron job in CodeIgniter and I need access to my models in order to perform it's tasks. Here's my controller code.
<?php
class Cron extends CI_Controller
{
public function send_mail() {
if ( PHP_SAPI !== 'cli' ) exit('No web access allowed');
echo "Hello World";
}
}
And if I run this command on the terminal
php /home/path/to/project/index.php cron send_mail
It doesn't return anything, it's not executing the function. But if I delete the database and session libraries from the autoload.php
file, it runs perfectly. Any ideas?