简体   繁体   中英

How do I use other directory to store session data

I'm new to PHP, so I don't know how to change default (/temp/) directory to store session data. eg I want to store all session() data in a seperate directory called (/root/sceret_data/). Do I need to change it in .htaccess ? I've no root access as Im on shared host.

Any help with example please ?

You can set the path with this PHP function:

session_save_path();

http://at.php.net/manual/en/function.session-save-path.php

The path /root is not the best idea. PHP have no write access there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM