CI 묻고 답하기

제목 세션 질문 하나 드립니다~
글쓴이 하늘치 작성시각 2015/01/15 15:27:19
댓글 : 12 추천 : 0 스크랩 : 0 조회수 : 23139   RSS
기존에 잘 돌아가던 웹사이트를 타서버로 이전하고 있습니다.

그런데 로그인도 안되고, 회원 가입시 자동등록방지 이미지(마냐님이 쓰신 kcaptcha)도 안나오는 상황입니다. 엑박은 아니구요. 
php 코드 앞뒤로 공백이 있거나 이런 것도 아닙니다.

세션이 만들어지는 건 확인을 했는데, 만들어진 다음 다른 페이지로 이동하면서 세션이 사라지더라구요.

어쨌든 찾다찾다 보니 php 설정 중에 session.save_path 라는 게 있더군요. 그래서 기존 서버의 설정값과 새로 이전하는 서버의 설정값을 비교해봤습니다.

옛 서버 : session.save_path    /var/php/sessions    /var/php/sessions
새 서버 : session.save_path    no value    no value

세션이 저장되지 않는 이유가 혹시 이것 때문일 수 있나요?

서버쪽은 제가 손을 댈 수 없는 상태인데, 또 찾아보니 이런 게 나왔습니다.

ini_set('session.save_path',realpath(dirname($_SERVER['DOCUMENT_ROOT'])).'/../session');

index.php 맨 위에다 넣어봤는데, 그래도 로그인도 안되고, 자동등록방지 이미지도 안나오네요;;

혹시 비슷한 경험을 해보셨거나 해결책을 아시는 분은 댓글 부탁드립니다~





덧..

config.php 파일입니다..
 
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|	http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
| $config['base_url']	= BASEURL;
|
*/
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'			Default - auto detects
| 'PATH_INFO'		Uses the PATH_INFO
| 'QUERY_STRING'	Uses the QUERY_STRING
| 'REQUEST_URI'		Uses the REQUEST_URI
| 'ORIG_PATH_INFO'	Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']	= 'AUTO';

/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/

$config['url_suffix'] = '';

/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language']	= 'korean';

/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';

/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean).  See the user guide for details.
|
*/
$config['enable_hooks'] = TRUE;


/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';


/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs.  When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';


/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array.  If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array']		= TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger']	= 'c';
$config['function_trigger']		= 'm';
$config['directory_trigger']	= 'd'; // experimental not currently in use

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|	0 = Disables logging, Error logging TURNED OFF
|	1 = Error Messages (including PHP errors)
|	2 = Debug Messages
|	3 = Informational Messages
|	4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';

/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';

/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder.  Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';

/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = 'zzzzzzzzzzzzz';

/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name'		= the name you want for the cookie
| 'sess_expiration'			= the number of SECONDS you want the session to last.
|   by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
| 'sess_expire_on_close'	= Whether to cause the session to expire automatically
|   when the browser window is closed
| 'sess_encrypt_cookie'		= Whether to encrypt the cookie
| 'sess_use_database'		= Whether to save the session data to a database
| 'sess_table_name'			= The name of the session database table
| 'sess_match_ip'			= Whether to match the user's IP address when reading the session data
| 'sess_match_useragent'	= Whether to match the User Agent when reading the session data
| 'sess_time_to_update'		= how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name']		= 'kisession';
$config['sess_expiration']		= 0;  /* 7200 */
$config['sess_expire_on_close']	= FALSE;
$config['sess_encrypt_cookie']	= FALSE;  /* FALSE */
$config['sess_use_database']	= TRUE;
$config['sess_table_name']		= 'ki_session';
$config['sess_match_ip']		= FALSE;  /* FALSE */
$config['sess_match_useragent']	= FALSE;  /* TRUE */
$config['sess_time_to_update']	= 600;

/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path'   =  Typically will be a forward slash
| 'cookie_secure' =  Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix']	= '';
$config['cookie_domain']	= '.zzzzzzzzzz.com';
$config['cookie_path']		= '/';
$config['cookie_secure']	= FALSE;

/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = TRUE;

/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
/*
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
*/

$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'ci_t';
$config['csrf_cookie_name'] = 'ci_c';
$config['csrf_expire'] = 7200;

/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads.  When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT:  If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts.  For
| compression to work, nothing can be sent before the output buffer is called
| by the output class.  Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;

/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or 'gmt'.  This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT.  See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';


/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files.  Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;


/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';


/* End of file config.php */
/* Location: ./application/config/config.php */




 
 다음글 엄청 초보적인건데, 갑자기 까먹었어요 ㅠㅠ (3)
 이전글 pagination 설정 처음으로 링크 추가 문제 (5)

댓글

변종원(웅파) / 2015/01/15 15:33:51 / 추천 0
뭔가 기본파일이나 코어쪽에서 건드린 것이 있는 것 같네요.
패스를 서버에서 건드리실 수 있는 곳으로 변경해보세요. (예를 들면 /home/사용자/ 라던가요)
하늘치 / 2015/01/15 15:40:15 / 추천 0
system 디렉토리는 전혀 손대지 않았구요..
말씀해주신 것처럼 session.save_path 를 사용자 계정 안으로 변경해봤지만, 여전하네요; 
config.php 파일도 이것 저것 다 해봤는데 말이죠;;
ㅠㅠ
초짜 / 2015/01/15 15:42:25 / 추천 0
저하고 같은 상황이네요...ㅠㅠ  구글크롬, 파이어폭스에서는 정상작동 하지 않던가여?
저 같은 경우는 그래요..

아시는분 가르침 부탁합니다. 
하늘치 / 2015/01/15 15:43:17 / 추천 0
로그 파일을 보니 이렇게 나옵니다..

ERROR - 2015-01-15 15:39:24 --> The session cookie data did not match what was expected. This could be a possible hacking attempt.

이게 뭘 의미하는 걸까요? ㅠㅠ
초짜 / 2015/01/15 15:44:54 / 추천 0
로그파일은 어떻게 보나요?.. 제쪽도 한번 확인해보겠습니다...
하늘치 / 2015/01/15 15:44:58 / 추천 0
@초짜// 
제 경우는 아무데서도 안됩니다;;
하늘치 / 2015/01/15 15:46:35 / 추천 0
@초짜// 

아래 디렉토리에서 확인할 수 있습니다.
/application/logs 

config.php 파일에서 log_threshold 값이 최소 1 이상으로 설정되어 있어야 할꺼에요..
하늘치 / 2015/01/15 15:52:56 / 추천 0
참고로,
이번에 처음으로 tank_auth 를 적용해서 회원 가입과 로그인만 되는 사이트를 만들고 있는데 요거 하나는 또 정상적으로 됩니다;;

서버를 이전하면서 사이트들을 옮기고 있는데, 나머지는 다 안되서 참 난감하네요;;
하늘치 / 2015/01/15 15:56:05 / 추천 0
하나 더..
phpmyadmin 도 로그인이 안됩니다. 이정도면 서버 설정 때문인 듯 한데 말이죠;;


요건 해당사항 없음입니다;; 

도움될만한 거면 무엇이든 남겨주세요~
저도 해결되는대로 남기도록 하겠습니다...
하늘치 / 2015/01/15 16:03:01 / 추천 0
서버 회사에 문의해본 결과...

session.save_path    no value    no value

위의 경우는 디폴트로 /tmp 로 연결이 된다는군요.


실제로 쉘로 검색해보니 세션이 생성되고 있었네요.. 
대체 뭐가 문제일까요;;

웹사이트 소스를 다 지우고, 다시 처음부터 이전해봐야겠습니다;;
초짜 / 2015/01/15 16:08:39 / 추천 0
저는 세션을 찾을수 없다고 나오네요.
아래에 로그 남깁니다..
 

DEBUG - 2015-01-15 07:43:44 --> Form Validation Class Initialized

DEBUG - 2015-01-15 07:43:44 --> Language file loaded: language/korean/form_validation_lang.php

DEBUG - 2015-01-15 07:43:46 --> Config Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Hooks Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Utf8 Class Initialized

DEBUG - 2015-01-15 07:43:46 --> UTF-8 Support Enabled

DEBUG - 2015-01-15 07:43:46 --> URI Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Router Class Initialized

DEBUG - 2015-01-15 07:43:46 --> No URI present. Default controller set.

DEBUG - 2015-01-15 07:43:46 --> Output Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Security Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Input Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Global POST and COOKIE data sanitized

DEBUG - 2015-01-15 07:43:46 --> Language Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Loader Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Controller Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Database Driver Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Model Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Model Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Model Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Session Class Initialized

DEBUG - 2015-01-15 07:43:46 --> Helper loaded: string_helper

DEBUG - 2015-01-15 07:43:46 --> A session cookie was not found.

DEBUG - 2015-01-15 07:43:46 --> Session routines successfully run

DEBUG - 2015-01-15 07:43:46 --> Helper loaded: form_helper

DEBUG - 2015-01-15 07:43:46 --> Helper loaded: url_helper

DEBUG - 2015-01-15 07:43:46 --> Helper loaded: alert_helper

DEBUG - 2015-01-15 07:43:46 --> Helper loaded: fileupload_helper

DEBUG - 2015-01-15 07:43:46 --> File loaded: application/views//inc/head.php

DEBUG - 2015-01-15 07:43:46 --> File loaded: application/views//main.php

DEBUG - 2015-01-15 07:43:46 --> File loaded: application/views//inc/footer.php

하늘치 / 2015/01/15 16:21:23 / 추천 0

일단, 해결은 됐습니다.
다시 안됩니다;;

됐다고 좋아했는데;;