Welcome Guest, Not a member yet? Register   Sign In
No output using CLI with CodeIgniter
#1

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 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


Code:
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?
Reply


Messages In This Thread
No output using CLI with CodeIgniter - by soda - 11-24-2015, 05:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB