New LNMP Environment, but session cross-page or refresh session lost

Source: Internet
Author: User

Nagging: Local Wamp did a project, everything OK, yesterday needs to build a set of LNMP environment in Linux. However, in the erection of the code, the login is always unsuccessful ~ ~ ~

Final Resolution: Permissions

In fact, as a program ape, as long as the server content involved, should be very aware of the issue of permissions. However, how to properly configure permissions, or that location is not configured to permissions, is more distressing. (All folders, give all permissions to ignore .....) )

The following details my environment deployment:

Please specify the source, cherish our own labor success ~ Thank you ... Http://www.cnblogs.com/Mwsoft/p/4806741.html

1, NGINX 1.4, PHP 5.5, MYSQL5.6 are installed through Yum

2, through the php.ini to find the session of the Save path

; Session.save_path = "/tmp"

3, but found to be annotated, carefully read the findings, in the above remarks, there is a description of PHP-FPM

; RPM Note:session directory must is owned by process owner; For mod_php, see/etc/httpd/conf.d/php.conf; For php-fpm, See/etc/php-fpm.d/*conf;session.save_path = "/tmp"

For PHP-FPM, see/etc/php-fpm.d/*conf, OK, although my English is not very good, but see (look), I think it is understood.

4,#vi/etc/php-fpm.d/www.conf

; Set session path to a directory owned by process Userphp_value[session.save_handler] = filesphp_value[session.save_path]< c3/>=/var/lib/php/sessionphp_value[soap.wsdl_cache_dir]  =/var/lib/php/wsdlcache

That means our session exists/var/lib/php/session

5, check the next directory (we want to see the directory of permissions configuration, of course, to see his parent directory)

#ll/var/lib/php/

DRWXRWX---2 root apache 4096 Sep 11:25 sessiondrwxrwx---2 root apache 4096 Sep  4 14:56 wsdlcache

I found a problem in a moment

Apache, our web server is Nginx, when installed through Yum, the Web server assigns itself an Nginx account and the Nginx group, but PHP does assign itself to the Apache group. You let Nginx run the Apache group thing???

6, the solution:

The first type (for lazy people only): #chmod 777/var/lib/php/session

Explanation: 9-, the first three are the current user, the Middle 3 is a group, and the last 3 are the other one,

The second (slightly more troublesome): Let them belong to the same group, you can create a WWW group, and then put Nginx and PHP, all in ..... For specific reference, create a user command and create a group command: Thank you

Please specify the source, cherish our own labor success ~ Thank you ... Http://www.cnblogs.com/Mwsoft/p/4806741.html

New LNMP Environment, but session cross-page or refresh session lost

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.