I am working in a subfolder on my website: www.example.com/subfolder
Now, i want to set a session that is only accessible within www.example.com/subfolder
To
You need to call session_start first (unless you have session.auto_start set to 1).
session_start