Welcome Guest, Not a member yet? Register   Sign In
Getting Error While Creating Cron Job
#1

[eluser]Unknown[/eluser]
Dear Friends,
I am creating a cron job through which I can change the status of the user in db table. the cron job script function "Logout_User_InActive" is placed in Controller named "cron.php". I have created a folder on on root named "cron" containing file "index.php". but as cron job runs it give me error:


PHP Warning: require_once(../system/codeigniter/CodeIgniter.php): failed to open stream: No such file or directory in /mnt/stor1-wc2-dfw1/466040/468475/www.click2learn.edu.pk/web/content/cron/index.php on line 40
PHP Fatal error: require_once(): Failed opening required '../system/codeigniter/CodeIgniter.php' (include_path='.:/usr/share/pear:/usr/share/php') in /mnt/stor1-wc2-dfw1/466040/468475/www.click2learn.edu.pk/web/content/cron/index.php on line 40

Suggest me changes.
Here is the code of my index.php file:
Code:
<?php
set_time_limit(0);
$_SERVER['PATH_INFO'] = '/cron/Logout_User_InActive';
$_SERVER['REQUEST_URI'] = '/cron/Logout_User_InActive';
    error_reporting(E_ALL);
    $system_folder = "../system";
    $application_folder = "application";
if (strpos($system_folder, '/') === FALSE)
{
    if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    {
        $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
    }
}
else
{
    // Swap directory separators to Unix style for consistency
    $system_folder = str_replace("\\", "/", $system_folder);
}
$system_folder = str_replace("\\", "/", $system_folder);
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');

if (is_dir($application_folder))
{
    define('APPPATH', $application_folder.'/');
}
else
{
    if ($application_folder == '')
    {
        $application_folder = 'application';
    }

    define('APPPATH', BASEPATH.$application_folder.'/');
}

require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;

/* End of file index.php */
/* Location: ./index.php */


Kindly suggest me
#2

[eluser]danmontgomery[/eluser]
Seems pretty obvious to me...

Quote:PHP Warning: require_once(../system/codeigniter/CodeIgniter.php): failed to open stream: No such file or directory in /mnt/stor1-wc2-dfw1/466040/468475/www.click2learn.edu.pk/web/content/cron/index.php

Either chdir() or correct the path to the file.




Theme © iAndrew 2016 - Forum software by © MyBB