php - Laravel session values are deleted immediately (Laravel 12) - Stack Overflow

I create session and session values are deleted when I refresh the page. I make the user login and when

I create session and session values are deleted when I refresh the page. I make the user login and when I refresh the page, auth()->user() returns me NULL value as if there is no one logged in. When I FILE the session driver value, it does not write anything to any file in the storage folder. When I make the driver value database, it does not write anything to the sessions table in the database.

I built my project over Docker.

Operating System: Windows

Laravel version: 12

PHP version: 8.4

Laravel Session Enviroment:

SESSION_DRIVER=database SESSION_LIFETIME=1400 SESSION_ENCRYPT=false SESSION_DOMAIN=null SESSION_SECURE_COOKIE=false

If I give an example I can get the value when I use a code like this

session([‘test’ => 123]);

dd(session(‘test’));

Then replace these codes, i.e.

dd(session(‘test’));

session([‘test’ => 123]);

I get the NULL value when I use it.

My dockerfile is like this:


WORKDIR /var/www/html

COPY . /var/www/html

######## Composer.phar ########
RUN curl -s  | php \
  # move composer into a bin directory you control:
  && mv composer.phar /usr/local/bin/composer \
  # double check composer works
  && composer about

RUN php -m && echo "============================================="

RUN apt-get update && apt-get install -y \
  libpng-dev \
  libxml2-dev \
  libxslt-dev \
  libzip-dev \
  libsodium-dev

RUN docker-php-ext-install \
  exif \
  opcache \
  pcntl \
  pdo_mysql \
  zip \
  sodium \
  sockets

RUN apt-get update && \
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \
docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
RUN docker-php-ext-install gd

RUN chmod -R 775 /var/www/html
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache

# Expose port 8001 and start php-fpm server
EXPOSE 8001
CMD ["php-fpm"]

The web part in my docker-compose.yml file is like this

    web:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: crypto
        working_dir: /var/www/html
        tty: true
        restart: unless-stopped
        volumes:
            - ./:/var/www/html
        networks:
            - crypto```


Can you help me, please?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744929235a4601630.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信