OCS Solutions Web Hosting Design and Consulting Web Hosting and Consulting Call Us
OCS Home  |  Wiki Front Page  |  Web Hosting  |  Virtual Dedicated Servers  |  Consulting  |  Support  |  Contact Us

Changing the Session Save Path

From OCS Support Wiki

Jump to: navigation, search

Introduction

You can change the session save path to a custom location for greater security in your web application with PHP.

Method

In the following examples, replace you with your FTP/SSH/cPanel username and session_path with the path that you want to save sessions in. We STRONGLY recommend it be outside the public_html folder. If you want to use the example above which will work in most cases, create a folder called session_path in your home directory (not the public_html folder).

On non-PHPSuExec servers, make sure the folder has 777 permissions so Apache can write to it.

If you're not sure which kind of server you're on, try the non-PHPSuExec method first. If you get an Internal Server Error (500) error, use the PHPSuExec method.

Non-PHPSuExec Method

If you don't have one already, create an .htaccess file and add this content to it:

php_value session.save_path "/home/you/session_path/" 

PHPSuExec Method

Create or modify your php.ini file in your public_html folder to include:

session.save_path = "/home/you/session_path/"
Personal tools