nginx PHP session failure solution: 1. Get the session directory; 2. Change the user group; 3. Set "session.use_trans_sid=1".
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
How to solve the problem of nginx php session failure?
Solution to the problem of cross-page session failure in nginx:
Get the session directory
Generally use session.save_path in php.ini Record the session in the storage directory of the server
session.save_path = "/var/lib/php/session"
Change the user group
chown -R nginx.nginx 'session.save_path'
Let’s take a look at the problem of disabling COOIKE in the browser:
session relies on cookies. When you visit When you visit a website, the server of this website will generate a unique session_id for you and store it in the client browser. When you jump to a page in the site, the browser will automatically send your unique session_id to the server, and the server will session_id gets session information. But when the browser disables cookies, your server cannot obtain the session_id, and the server cannot obtain your session information, which will cause the session to become invalid.
The solution is introduced below:
In this case, you can set session.use_trans_sid=1. When we send a request to the server, the URL will automatically transmit the value of session_id.
session.use_trans_sid=1
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to solve the problem of nginx php session failure. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
