dongzhukuai8177
2018-12-06 18:18
浏览 114
已采纳

将我的Codeigniter站点从实时服务器移动到localhost时出现问题

I am moving my CodeIgniter site from live server to localhost. I have downloaded the files via ftp and database file from Phpmyadmin then i set everything and configured database. But the problem is only my homepage is accessible no login or form submission is happening whatever i do i am redirected to home but that is not the case on live server. I cant understand whats the issue why its working perfectly fine on live server but not on localhost.

I think the problem is that sessions are not working because i cant login. Below are my config file session settings.

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400; //7200
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update'] = 300; //300
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;

$config['cookie_prefix']    = 'app';
$config['cookie_domain']    = 'localhost';
$config['cookie_path']      = '/app/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;

图片转代码服务由CSDN问答提供 功能建议

我正在将我的CodeIgniter站点从实时服务器移动到localhost。 我已经从Phpmyadmin通过ftp和数据库文件下载了文件然后我设置了所有内容并配置了数据库。 但问题是只有我的主页可以访问没有登录或表单提交正在发生我无论如何我被重定向到家但在实时服务器上的情况并非如此。 我无法理解为什么它在实时服务器上工作得很好的问题 但不是在localhost上。

我认为问题是会话无法正常工作,因为我无法登录。 下面是我的配置文件会话设置。

  $ config ['sess_driver'] ='database'; 
 $ config ['sess_cookie_name'] ='ci_session'; 
  $ config ['sess_expiration'] = 86400;  // 7200 
 $ config ['sess_save_path'] ='ci_sessions'; 
 $ config ['sess_match_ip'] = FALSE; 
 $ config ['sess_match_useragent'] = FALSE; 
 $ config ['sess_time_to_update']  = 300;  // 300 
 $ config ['sess_regenerate_destroy'] = FALSE; 
 $ config ['sess_encrypt_cookie'] = FALSE; 
 
 $ config ['cookie_prefix'] ='app'; 
 $ config ['cookie_domain  '] ='localhost'; 
 $ config ['cookie_path'] ='/ app /'; 
 $ config ['cookie_secure'] = FALSE; 
 $ config ['cookie_httponly'] = FALSE; 
 <  / code>  
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doufeikuang7724 2018-12-13 06:29
    已采纳

    i got this solution from Codeigniter session data lost after redirect by @user2818832 it worked for me.!

    if you are working in CI 3.x and just upgraded your server php version to php 7.x

    Go to system/libraries/Session/session.php at Line no 281 and replace ini_set('session.name', $params['cookie_name']); by ini_set('session.id', $params['cookie_name']);

    打赏 评论

相关推荐 更多相似问题