Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter incorrect system path on private server

codeigniter project when uploaded to server gives me the following error.

Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

it is working well locally & on 000webhost.com hosting.

When uploaded to private server of parallels it gives the above error.

My index.php is as follows.

<?php
define('ENVIRONMENT', 'development');

if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
    case 'development':
        error_reporting(E_ALL);
    break;

    case 'testing':
    case 'production':
        error_reporting(0);
    break;

    default:
        exit('The application environment is not set correctly.');
}
 }
$system_path = 'system';
$application_folder = 'application';


if (defined('STDIN'))
{
    chdir(dirname(__FILE__));
}

if (realpath($system_path) !== FALSE)
{
    $system_path = realpath($system_path).'/';
}

$system_path = rtrim($system_path, '/').'/';

if ( ! is_dir($system_path))
{
    exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}

define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.php');

// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));

// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));

// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));


// The path to the "application" folder
if (is_dir($application_folder))
{
    define('APPPATH', $application_folder.'/');
}
else
{
    if ( ! is_dir(BASEPATH.$application_folder.'/'))
    {
        exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
    }

    define('APPPATH', BASEPATH.$application_folder.'/');
}
 require_once BASEPATH.'core/CodeIgniter.php';
like image 615
Mohammad Sadiq Shaikh Avatar asked Jan 15 '14 02:01

Mohammad Sadiq Shaikh


3 Answers

try this .htaccess on root folder

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

assumming that index.php is your index page.

and change in config.php

$config['index_page'] = '';
like image 50
ReNiSh AR Avatar answered Nov 17 '22 00:11

ReNiSh AR


If You uploading Your project follow these steps

  1. Make sure You have upload application, system, index.php, .htaccess

  2. Modify your config/database.php with your hosted database.

  3. Make sure URL spellings, Cz LINUX Hosting is Case-Sensitive.

  4. Make sure all resources are uploaded to server. (CSS, JS, Images, etc ...)

Hopes this helps You :)

like image 1
Abdulla Nilam Avatar answered Nov 17 '22 00:11

Abdulla Nilam


I have same issue then i create controller inside that i have created index method then call cron file with below command it is working for me.

wget domain_name/google_script -O /dev/null

google_script = "My controller class name"

this solution work for me.

like image 1
Denis Bhojvani Avatar answered Nov 16 '22 22:11

Denis Bhojvani