简体   繁体   English

将我的Codeigniter站点从实时服务器移动到本地主机时出现问题

[英]Problem in moving my Codeigniter site from live server to localhost

I am moving my CodeIgniter site from live server to localhost. 我将我的CodeIgniter站点从实时服务器移至localhost。 I have downloaded the files via ftp and database file from Phpmyadmin then i set everything and configured database. 我已经通过ftp下载了文件,并从Phpmyadmin下载了数据库文件,然后设置了所有内容并配置了数据库。 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;

i got this solution from Codeigniter session data lost after redirect by @user2818832 it worked for me.! 我从@ user2818832 重定向后丢失的 Codeigniter 会话数据中获得了此解决方案,它对我有用。

if you are working in CI 3.x and just upgraded your server php version to php 7.x 如果您在CI 3.x中工作,并且刚刚将服务器php版本升级到php 7.x

Go to system/libraries/Session/session.php at Line no 281 and replace ini_set('session.name', $params['cookie_name']); 转到第281行的system / libraries / Session / session.php并替换ini_set('session.name',$ params ['cookie_name']); by ini_set('session.id', $params['cookie_name']); 通过ini_set('session.id',$ params ['cookie_name']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM