0

I am accessing a Putty server to try and run a method from a controller.

I have a controller inside a batch folder named GetPrefectures.

The controller's code:

<?php
require_once(APPPATH."controller/batch/GetIndustry.php");

class GetPrefecture extends BaseController
{

function __construct()
{
    $this->load->model("PrefectureModel", "prefModel");
}

public function init() 
{
    log_message('test_debug');
    $this->checkSteps();
}

public function checkSteps()
{
    $completed_steps = $this->prefModel->checkStepstbl();

    $this->getList($completed_steps);
}
}
?>

I try to add a log message so I know that the controller is working.

Here's how I do it. after I access the server and locate the path for my file, I enter the code to run the controller.

php /var/www/listingapp/public/index.php batch/GetPrefecture init

then, I use the logs with this code to check if it is running.

tail -n1000 -f application/logs/log-2017-08-25.php

But after this, the cmd shows me this as logs:

<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
DEBUG - 2017-08-25 10:55:46 --> UTF-8 Support Enabled
DEBUG - 2017-08-25 10:55:46 --> Global POST, GET and COOKIE data sanitized

I cannot see any log message "test_debug", I think it cannot detect the init, so this means nothing is running. How can I do this? Am I missing something?

andil01
  • 377
  • 4
  • 19
  • It doesn't look like your PHP is being run. Is PHP running? If necessary, use the absolute path to php, not just "php". Also, it looks like you are on Linux or Mac. Why use Putty when you can just use the terminal? – Brian Gottier Aug 25 '17 at 03:32
  • already tried "/usr/bin/php /var/www/listingapp/public/index.php batch/GetPrefecture init". I'm using putty because I will later deploy the script on it. – andil01 Aug 25 '17 at 03:56
  • Try `/usr/bin/php /var/www/listingapp/public/index.php getprefecture init` – Brian Gottier Aug 25 '17 at 03:57

0 Answers0