Extra Form
PHP PHP 7.4
CMS Rhymix 2.x

xe타운에서 서버설정과 관련한 글을 읽으며 하나씩 해보고있습니다.

 

세션은 memcached로 설정하고

라이믹스의 캐시 사용은 file 로 설정했습니다.

 

게시판을 왓다갔다 하다보면 로그인이 풀린걸로 보였다가 다시 로그인이 된걸로보였다가 그러네요.

게시판 여러개를 동시에 탭으로 띄우면 아예 로그인이 풀리기도하구요.

어디를 손봐야할지 도통 모르겠습니다.

 

 

 

; http://php.net/session.save-handler
;session.save_handler = files
session.save_handler = memcached
;session.save_handler = redis


; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; The path can be defined as:
;
;     session.save_path = "N;/path"
;
;
; where N is an integer.  Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories.  This is useful if
; your OS has problems with many files in one directory, and is
; a more efficient layout for servers that handle many sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
;         You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
;         use subdirectories for session storage
;
; The file storage module creates files using mode 600 by default.
; You can change that by using
;
;     session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
;session.save_path = "/var/lib/php/sessions"
;
session.save_path = "128.0.0.1:11211"
;session.save_path = "tcp://127.0.0.1:6379?timeout=2&database=1"
          

 

  • profile

    localhost는 128.0.0.1이 아니라 127.0.0.1입니다.

    아이피가 틀려서 memcached에 접속을 못 하면 로그인이 풀릴 수도 있겠지요.

     

    도저히 다른 방법이 없는 경우가 아니라면 file 캐시는 절대 비추입니다.

    단, 캐시와 세션을 모두 memcached로 쓴다면 캐시를 비울 때마다 로그인이 풀리겠죠...

    요즘 apc가 괜찮아서 캐시 방식으로는 apc를 추천합니다.

  • profile ?
    아~ 제가 글을 수정하다보니 오타가 있었나봅니다.

    현재상태
    session.save_path = "127.0.0.1:11211"

    apc로 한번 바꿔봐야겠네요...
  • ? profile

    그리고 제 경험상 memcached 세션은 문제가 많더군요. 기본값 그대로 files로 해두고 쓰시거나... 만약 redis를 설치하실 수 있다면 redis 세션이 훨씬 안정적입니다. 맨 밑에 주석처리되어 있는 설정이 redis 설정이네요.

  • profile ?
    네. 서버설정하는 공부부터 좀 해야할것 같아서요 ㅜㅜ
    모르는것 투성이네요 ㅎㅎ
  • profile ?

    라이믹스 캐시는 memcached
    세션은 redis

    상당히 빨라졌습니다..
    그동안 세션을 file 기본값으로 했었는데...
    로그인할때부터 확연히 다르네요....

  • profile ?

    저같은 경우 라이믹스 설치폴더를 SSD에 넣고 운영해서그런건지

     file과 memcached의 차이를 체감적으로 못느끼겠더라구요..


    일반 HDD를 쓰시는 사람에게 해당되는 말씀이신지 궁금하네요

  • ? profile
    아뇨, 어떤 경우에도 file은 비추입니다. SSD가 제아무리 빨라봐야 RAM에 비하면 아무것도 아니니까요.
  • profile ?

    redis가 설치 되어있고 tools 설치를 했습니다.

    vi /etc/php/7.4/cli/php.ini
    vi /etc/php/7.4/apache2/php.ini

    주석으로 처리된 부분이 없어서 session.save_handler = files로 된 것을 redis 로 변경해 봤는데 로그인이 되지 않네요.
    다시 원상태로 돌려 놓으니 로그인은 되는데 말씀하신 것을 적용하려면 어떻게 해야하나요?

  • ? profile
    맨 꼭대기 질문글에 포함된 소스 기준으로
    4줄, 38줄 주석 해제하시고, 각각 그 윗줄은 주석처리하세요.
  • profile ?

    스크린샷 2021-02-02 오전 11.51.47.png.jpg

    저는 이렇게 되어있어서 files를 radis로 수정하고 

    38줄에 있던걸 복사해서 붙여 넣었는데 로그인이 안되네요. 

  • ? profile
    radis (X) redis (O)