GithubHelp home page GithubHelp logo

Comments (25)

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Are you sure that the table schema is updated in your project?

CREATE TABLE `ci_sessions` (
  `id` varchar(40) NOT NULL,
  `ip_address` varchar(45) NOT NULL,
  `timestamp` int(11) NOT NULL,
  `data` blob NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ip_address` (`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

bcit-ci/CodeIgniter#3073 (comment)

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Yep, its exactly the same. The first session writing is working very well, and when i deleted this piece of code 171-180 Session_database_driver.php its working too but its important fragment.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Ok, I am working on a real application and I will switch it into the database driver for seeking problems.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

I turned on the database driver with these settings:

$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

It works, I don't see an error so far.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Thats my configuration:

$config['sess_driver']          = 'database';
$config['sess_cookie_name']     = 'ac584bae';
$config['sess_expiration']      = 4 * 60 * 60;  // 4 hours
$config['sess_save_path']       = 'ci_sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_time_to_update']  = 300;

$config['cookie_prefix']    = '';
$config['cookie_domain']    = (IS_CLI || $_SERVER['SERVER_NAME'] == 'localhost') ? '' : $_SERVER['SERVER_NAME'];
$config['cookie_path']      = $DETECT_URL['base_uri'];
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;

and its stil not working :/ for sure i will install second copy of your project on my server and i will check it.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Try a clean install of my project and test this http://iridadesign.com/starter-public-edition-4/www/playground/captcha

It uses the session.

If the problem persists, install a clean CodeIgniter, download it from 'feature/session' branch, it contains the new Session library I use. Write simple test code in the home page.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Another error after clean install of your project. I checked on 3 database- 2 remote and local.

Error Number: HY000/1

no such table: ci_sessions

SELECT "data" FROM "ci_sessions" WHERE "id" = 'b05f96e1985be82468279e896d083c628fb03384'

Filename: libraries/Session/drivers/Session_database_driver.php

Line Number: 138

In each database is exist the table.

The branch 'feature/session' works very well.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

platform/common/config/database.php - Did you set connection data there?

platform/common/config/database.php - Did you autoload the database?

$autoload['libraries'] = array(
    'database',
    'session',
    'events',
);

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Of course i do. The same settings are in clean CI and it works.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Yes, I've just seen the error 'no such table: ci_sessions'. I will see why is that.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Still seeking, for now I've reported issue 3473 to CodeIgniter.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

So, could you propose me other safe method for storing session in CI? I need to how fast i can start the application but i need safe session, because its a e-shop.

Thanks for all :)

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Ah yes, I found it. In the site_example application I connect to a demo database.

Rename the file platform/applications/site_example/config/database.php into _database.php

An then see whether it works. Some of the demos would get broken, but this is expected, you will remove them anyway.

I use for my developments the 'files' driver for months, I don't see problems with it. But anyway, check the database driver in your server, it is good to know that alternative works, just in case.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Ok, that`s was the problem. But my previously problem was other. fortunately i found solution. I had to create database.php in config of my application not edit in common folder and now sessions seem to be works correctly. I will test it tonight.

But i have another... too with session. Maybe this is correct but i have to ask you.
When I write var_dump() command the sessions shout:

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /blah/blah/blah/public_html/platform/applications/shop/modules/offline/controllers/Offline_controller.php:14)
Filename: Session/Session_driver.php
Line Number: 102

A PHP Error was encountered
Severity: Warning
Message: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent
Filename: Session/Session.php
Line Number: 638

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

It is normal var_dump() to cause these warning before session has been initialized. Don't pay attention on these.

When the issue CI 3473 gets closed I will upgrade immediately with a special release candidate only on this. So, let this issue stay open as a reminder until then.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Ok, thanks,

I was wrong. Problem with session does not go away :/

Error Number: 1062
Repetition '37e41ffa8b017ed3c7080cebfa3ec4cc5e6c250e' for key 'PRIMARY'
INSERT INTO `mys_ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('37e41ffa8b017ed3c7080cebfa3ec4cc5e6c250e', '83.27.60.187', 1421165160, '')
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 173

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Hm... this should not be allowed to happen at all. I'll wait to see how code would change. Meanwhile use the 'files' driver.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

@Exelord

I've made a release v4.0.0-rc60 after CI 3473 has been closed. The database driver works for me, I hope it to be OK in your place too.

After the change this is what narfbg wrote "You better don't use a database other than PostgreSQL and MySQL for storing session data, as it won't have locks."

I don't know which of the two drivers is "better", maybe this would be clarified within CI documentation. I used to use the 'files' driver.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

OK, thanks for all :)
So I will test it tomorrow and if database session wont wokrs i will try use yours method :)

Btw.
Did you know fast method to update your project on my server without changing necessary files where i made changes?

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

No, I don't know automatic way, I use FTP and I can see what GIT-controlled files/directories has changed and I update only them.

I did not expect that I would have to make so many release candidates. When CI3 is out I would make a stable release and after that the project will not change so fast.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Ok, so i think you can close the issue now.

Did you think about add a Polish translation or write a documentation of your project?

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Ok, I'll add the Polish translation. The README file will be extended before the stable release.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

@Exelord

For database driver: I think, when the front-end and back-end have different session id (totally independent sessions), then the database tables for session support should be two with different names. Just crossed my mind.

from starter-public-edition-4.

Exelord avatar Exelord commented on June 2, 2024

Hmm, maybe thats the correct way. Anyway, when I updated to latests changes database_driver it was terrible. Tons of error. And i decide to use Redis session. Maybe when CI3 will be official release the database session will be usable. But fortunately I noticed increased speed of loading sessions. So Im happily Redis user :)

Btw.
I have 3 other application but on the old version of your project and there database session works fine. Admin app and the site app use one DB and ci_sessions table. Its crazy :)

Could I write to you email? I found something weird but i wont create unnecessarily a new issue.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on June 2, 2024

Yes.

from starter-public-edition-4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.