Session not working on live server hostgator but working on my test live server and localhost

1,282 views
Skip to first unread message

DevMan12

unread,
Mar 28, 2018, 10:25:25 AM3/28/18
to Fat-Free Framework
I am working on a project, works fine on my local machine and on my test live server. But when uploaded to my client, the session is not working. here is just the basic implementation:

# I have set the folder for my cache which is writable
$f3->set('CACHE','folder=' . APP_PATH . 'cache/');

# instantiated my cache somewhere in the base controller
$sessionCache = \Cache::instance();// Session cache
$sess = new \Session(NULL,NULL,$sessionCache);
$f3->CSRF = $sess->csrf();

# then on my path controller instantiated a token and the session
$f3->set("csrftoken", $f3->CSRF);
$f3->set("SESSION.csrf", $f3->CSRF);

the problem on the hostgator server, there is no value on "SESSION.csrf" and checking the session_id(), there is none but there is a token generated from $sess->csrf().. what could be the problem here? I have updated to the latest fatfree and also the cache folder is writable. Thanks in advance

ved

unread,
Mar 28, 2018, 3:03:07 PM3/28/18
to Fat-Free Framework
Hi,

- What is APP_PATH ? Is it defined before? 
- Are you setting your DEBUG variable to 3?
- Any errors on the webserver or php logs?
- What happens if you don't set the CACHE variable?
- What happens if you don't use the cache session handler? (For example, use one of F3's database session handlers or even php's default sessions)
- Can you enable APC, memcache or Redis and try those as cache backend instead of "folder=..." ? What are the results?
- PHP version?

Answering some of these things may help narrow down what's happening. Please post the complete code if you still can't narrow it down.

But TL;DR: your #1 problem is hostgator :-)

DevMan12

unread,
Mar 28, 2018, 11:05:30 PM3/28/18
to f3-fra...@googlegroups.com
- APP_PATH is defined
- DEBUG is 1
- I don't have access to web server only on FTP
- havent tried setting CACHE to different folder
- I have used PHP session and it works but I want to implent F3 session and to know what really is the problem here.
- I cant enable APC as I only have access to FTP
- I am using PHP 7.1 and the latest 3.6 F3.

Btw I have used this style of coding before on a couple of websites that I have worked on from different clients and they all worked flawlessly, this is the first time I have encountered this. Maybe its from the hostgator shared settings I don't know atm as my client wont let me have the hosting.

best regards.

DevMan12

unread,
Mar 28, 2018, 11:12:20 PM3/28/18
to f3-fra...@googlegroups.com
Is there a way I can dump the error logs in the frontend? I have set the DEBUG to 3 but havent got anything yet. I tried to make the token to blanks to see if there will be a login successful now I am also encountering this.

"Cannot modify header information - headers already sent by (output started at filename here...:1)"

"[lib/base.php:2190] Base->error()
[lib/base.php:1408] header()
[app/controllers/admin/login.php:48] Base->reroute()
[lib/base.php:1806] Controllers\Admin\Login->post_login()
[lib/base.php:1627] Base->call()
[index.php:26] Base->run()

DevMan12

unread,
Mar 29, 2018, 12:57:17 AM3/29/18
to Fat-Free Framework
I have manage to find the culprit, it is the "Cannot modify header information - headers already sent" problem that is causing the session not to write properly somehow. After I have fixed it everything works as it should, so hopefully this will be helpful to somebody that will encounter this also.

DANIEL VITE VICTOR

unread,
Aug 17, 2019, 9:01:02 PM8/17/19
to Fat-Free Framework
Como le hiciste para resolver 


El miércoles, 28 de marzo de 2018, 22:57:17 (UTC-6), DevMan12 escribió:
Me las arreglé para encontrar al culpable, es el problema "No se puede modificar la información del encabezado - encabezados ya enviados" que está causando que la sesión no se escriba correctamente de alguna manera. Después de arreglarlo, todo funciona como debería, así que espero que esto sea útil para alguien que también lo encuentre.
Reply all
Reply to author
Forward
0 new messages