将PHP会话存储在共享磁盘中[重复]

This question already has an answer here:

Is it possible to store PHP sessions files on a disk which is shared by multiple instances? This way, a user can send requests to different servers and he will have the same session data.

What are the disadvantages or risks of this approach? (I understand this doesn't scale well, and has performance issues, but let's assume performance and scalability are not important at this stage)

</div>

You have to use a NFS server which is common and mounted (NFS clients) on all the instances (servers) which will finally makes a common place for the sessions to be stored and accessed. For detailed info, please check this

According the PHP manual, it can be done, and actually one of the comments mention successfully doing this, here you are http://php.net/manual/en/function.session-save-path.php#80901

You can do it, but its probably not a good choice. With NFS you will get poor performance due to locking patterns, and it won't scale well.

For storing PHP sessions and sharing them between machines, it is highly recommended to use an external service - either memcache (both memcache and memcached PHP extensions offer easy-to-set-up session storage module), or redis, or even a relational DB (e.g. MySQL). All would be a better choice than NFS in most cases.