jned29
jned29

Reputation: 478

Need help! I can't connect my program in oracle 11g using codeigniter

I have a program created using mysql and soon will e migrated to oracle 11g database. My problem is my page always 'Not Found' even if I already set up all the changes in my config.php and database.php

Here's my code

config.php

$config['base_url'] = 'http://192.168.0.112:1521/testing/';

or

$config['base_url'] = 'http://192.168.0.112/testing/';

I also tried to add index.php on the url

database.php

$active_group = 'oracle';
$active_record = TRUE;

$tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.112)(PORT = 1521))
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))';
//112
$db['oracle']['hostname'] = $tnsname;
$db['oracle']['username'] = 'sample';
$db['oracle']['password'] = 'samplepass';
$db['oracle']['database'] = 'test';

$db['oracle']['dbdriver'] = 'oci8';
$db['oracle']['dbprefix'] = '';
$db['oracle']['pconnect'] = TRUE;
$db['oracle']['db_debug'] = TRUE;
$db['oracle']['cache_on'] = FALSE;
$db['oracle']['cachedir'] = '';
$db['oracle']['char_set'] = 'utf8';
$db['oracle']['dbcollat'] = 'utf8_general_ci';
$db['oracle']['swap_pre'] = '';
$db['oracle']['autoinit'] = TRUE;
$db['oracle']['stricton'] = FALSE;

Please don't mark it as duplicate I haven't found solutions on other questions here. I tried to refer to some links, but still not working.

Output:

Not Found

The requested URL /testing/index was not found on this server.

Apache/2.2.3 (CentOS) Server at 192.168.0.112 Port 80

Upvotes: 2

Views: 459

Answers (1)

dhruv jadia
dhruv jadia

Reputation: 1680

change from

$config['base_url']    = 'http://192.168.0.112/testing/';

to

$config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])) . '/';

$config['base_path'] = $_SERVER['DOCUMENT_ROOT'] . preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])) . '/';

and also change from

$active_group = 'oracle';
$active_record = TRUE;

$tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.112)(PORT = 1521))
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))';
//112
$db['oracle']['hostname'] = $tnsname;
$db['oracle']['username'] = 'sample';
$db['oracle']['password'] = 'samplepass';
$db['oracle']['database'] = 'test';

$db['oracle']['dbdriver'] = 'oci8';
$db['oracle']['dbprefix'] = '';
$db['oracle']['pconnect'] = TRUE;
$db['oracle']['db_debug'] = TRUE;
$db['oracle']['cache_on'] = FALSE;
$db['oracle']['cachedir'] = '';
$db['oracle']['char_set'] = 'utf8';
$db['oracle']['dbcollat'] = 'utf8_general_ci';
$db['oracle']['swap_pre'] = '';
$db['oracle']['autoinit'] = TRUE;
$db['oracle']['stricton'] = FALSE;

to

$active_group = 'default';
$active_record = TRUE;

//112
$db['default']['hostname'] = 192.168.0.112;
$db['default']['username'] = 'sample';
$db['default']['password'] = 'samplepass';
$db['default']['database'] = 'test';

$db['default']['dbdriver'] = 'oci8';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Upvotes: 1

Related Questions