Welcome Guest, Not a member yet? Register   Sign In
Sessions
#1

(This post was last modified: 01-01-2019, 08:05 AM by Knutsford.)

I now can't log into the admin or the seller or buyer areas?

The config has


$config['sess_driver'] = 'files';
$config['sess_save_path'] = FCPATH.'ci_sessions';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;


When I look in  ci_sessions there is a session in there for when I log in but after that it has created a new session every second or more

It is only writing something to ci_sessions once you have tried to log in. Non of the old sessions are getting deleted either if that helps.

Any Ideas please?
Reply
#2

(This post was last modified: 01-01-2019, 08:49 AM by dave friend.)

Nothing obviously wrong with those settings.

Possibly a cookie $config problem. Please show those values too. Might also be how you are using session. Show enough code so we can get a feel for that please.
Reply
#3

This is how I set mine up and they work just fine.

Create a folder under ./application called writable.

PHP Code:
./application/writable 

Then set your config file like this.

PHP Code:
$config['sess_save_path'] = APPPATH.'writable'

As far as sessions not being deleted check your php.ini session settings.

Make sure that:

Code:
# Default session parameters
session.gc_probability = 1   # Make sure that this is not set to 0 (ZERO)
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

This works very well for me using this setup.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.lazy_write On On
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /opt/alt/php72/var/lib/php/session /opt/alt/php72/var/lib/php/session
session.serialize_handler php php
session.sid_bits_per_character 4 4
session.sid_length 32 32
session.upload_progress.cleanup On On
session.upload_progress.enabled On On
session.upload_progress.freq 1% 1%
session.upload_progress.min_freq 1 1
session.upload_progress.name PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS
Reply
#5

What permissions should ci_sessions have?
Reply
#6

(This post was last modified: 01-02-2019, 03:51 AM by Knutsford.)

All I know is thatt when I log in I get an entry

ci_session83caf69c2f12713c5348f461503447b7

Containing

__ci_last_regenerate|i:1546369534;logged_in|a:5:{s:7:"user_id";s:2:"21";s:9:"user_name";s:6:"Pamela";s:10:"user_email";s:29:"[email protected]";s:20:"type_of_last_payment";s:0:"";s:9:"user_type";s:6:"seller";}successmsg|s:31:"You are successfully logged in.";__ci_vars|a:1:{s:10:"successmsg";s:3:"new";}



in ci_session



Then ci_session9a14cc56047430275f53a9d9be52dd6d

which is completely empty


then

ci_sessionc7877c62d115003cf62ec4eb05e753de

containing

__ci_last_regenerate|i:1546369534;




Then more completely empty ones





Why? The code hasn't been changed since it was last working. When I look as the session stored on my PC the value is one of the totally empty ones. What is going on? I have no idea how it is supposed to work but surely those extra entries shouldn't be there?







I have done some more testing


Every time I go to anew page I get something like


ci_sessionc7877c62d115003cf62ec4eb05e753de

containing

__ci_last_regenerate|i:1546369534;



in ci_session and the session value is written to my PC





When I try and log in the Session value on my PC isn't being changed






Hmm it is codeignitor 3.0.6

And the Host has upgraded to PHP 7.2.6 since it was working



Could that be the problem?


How do I upgrade to the latest codeognitor? I didn't write the site originally and I hadn't realised it was that old
Reply
#7

Thanks for sharing your php.ini values. I was asking for config values from /application/config/config.php related to sessions.

Specifically
PHP Code:
$config['cookie_prefix'] = ?;
$config['cookie_domain'] = ?;
$config['cookie_path'] = ?
$config['cookie_secure'] = ?
$config['cookie_httponly'] = ? 

The problems you describe often happens if cookies are not working correctly.

If new files are created in FCPATH/ci_sessions/ you do not have a permission problem.

You should seriously consider upgrading to CodeIgniter 3.1.9 which is very easy to do from 3.0.6.

  1. Download the current version
  2. Replace all files and directories in your system/ directory using the new version's system/ directory
  3. Check each of the "Upgrading from ..." instruction pages starting with Upgrading from 3.03. to 3.1.0

You can ignore Step 1 on each of those pages because you already did it in #1 above.
You can use the Previous link on the bottom of each page to go to the next set of instructions.
The only item you will probably need to do out of all the upgrades is to replace application/config/mimes.php but you should confirm that for yourself.
Reply
#8

(01-02-2019, 08:48 AM)dave friend Wrote: Thanks for sharing your php.ini values. I was asking for config values from /application/config/config.php related to sessions.

Specifically
PHP Code:
$config['cookie_prefix'] = ?;
$config['cookie_domain'] = ?;
$config['cookie_path'] = ?
$config['cookie_secure'] = ?
$config['cookie_httponly'] = ? 

The problems you describe often happens if cookies are not working correctly.

If new files are created in FCPATH/ci_sessions/ you do not have a permission problem.

You should seriously consider upgrading to CodeIgniter 3.1.9 which is very easy to do from 3.0.6.

  1. Download the current version
  2. Replace all files and directories in your system/ directory using the new version's system/ directory
  3. Check each of the "Upgrading from ..." instruction pages starting with Upgrading from 3.03. to 3.1.0

You can ignore Step 1 on each of those pages because you already did it in #1 above.
You can use the Previous link on the bottom of each page to go to the next set of instructions.
The only item you will probably need to do out of all the upgrades is to replace application/config/mimes.php but you should confirm that for yourself.


$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;


You have just beaten me as I was just looking at the upgrade before I got your email. I was googling this morning and someone else had the same problem and said an upgrade sorted it out so fingers crossed. It does look very simple to do the upgrade I will try after tea
Reply
#9

SEE ALSO https://forum.codeigniter.com/thread-72523.html ??
Reply
#10

Yippee - the upgrade worked
Reply




Theme © iAndrew 2016 - Forum software by © MyBB