我有一个使用mysql创建的程序,很快就会迁移到oracle 11g数据库。我的问题是我的页面总是'找不到',即使我已经在config.php和database.php中设置了所有更改
这是我的代码
的config.php
$config['base_url'] = 'http://192.168.0.112:1521/testing/';
或
$config['base_url'] = 'http://192.168.0.112/testing/';
我还尝试在url上添加index.php
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;
请不要将其标记为重复我在此处未找到其他问题的解决方案。我试图引用一些链接,但仍然无法正常工作。
输出:
未找到
在此服务器上找不到请求的URL /测试/索引。
Apache / 2.2.3(CentOS)服务器,位于192.168.0.112端口80
答案 0 :(得分:1)
从
改变$config['base_url'] = 'http://192.168.0.112/testing/';
到
$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'])) . '/';
也从
改变$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;
到
$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;