Are PHP Sessions enabled by default?


#1

Are PHP’s sessions enabled by default? I have a php.ini file in my root, which is the default one for cloud9 PHP projects, and I don’t seem to be able to use sessions. I am calling session_start() and I’m sure I’ve got the right variable names. Done some googling that implies it isn’t enabled and we need to modify php.ini, but nobody explains what needs to be modified.

Cheers!


#2

What is the workspace you created? I forgotten exactly, it was PHP MySQL workspace or something like that, it had everything working from scratch.

Also try reading this.


#3

I’ve done all that, now the following error ensues:

Warning: session_start(): open(C:\php\sessiondata/sess_mo553sf0pfmamme6586b89mdt6, O_RDWR) failed: No such file or directory (2) in /home/ubuntu/workspace/global.php on line 3 Call Stack: 0.0015 233384 1. {main}() /home/ubuntu/workspace/index.php:0 0.0016 233976 2. require_once(’/home/ubuntu/workspace/global.php’) /home/ubuntu/workspace/index.php:3 0.0016 234024 3. session_start() /home/ubuntu/workspace/global.php:3 Warning: Unknown: open(C:\php\sessiondata/sess_mo553sf0pfmamme6586b89mdt6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\php\sessiondata) in Unknown on line 0

And yes, I used the PHP MySQL Workspace (or whatever it was called) to create this.


#4

Well, you are not on Windows, the workspaces run on top of Linux. So this path C:\... will not work. Change that part to /tmp/php/session_data/ or something similar.


#5

Cheers @vasilenko93 ! Set it to home/ubuntu/sessions which works, and I also did some refactoring as my logic to load the session data was flawed.