Welcome Guest, Not a member yet? Register   Sign In
Problem with session_start()
#1

I have a problem with the CAS authentication library in CI3. In CI2.x worked perfectly but with the CI3, the session has been re-designed and it seems to have problems with this library.

This is the error I get:

Code:
A PHP Error was encountered

Severity: Runtime Notice

Message: session_start() [function.session-start]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead

Filename: CAS/Client.php

Line Number: 3620

Code:
A PHP Error was encountered

Severity: Error

Message: session_start() [function.session-start]: Failed to initialize storage module: user (path: C:\Windows\Temp)

Filename: CAS/Client.php

Line Number: 3620

Here is my config.php settings:

PHP Code:
$config['sess_driver'] = '[color=#ff3366]database[/color]';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = '[color=#ff3366]ci_sessions[/color]';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE

Note that I'm using a table called 'ci_session' in my database to store the session as stated in the CI3 user manual. It works perfectly but once I load the CAS library I get the previous error in the session_start() line.

CAS library
https://github.com/eliasdorneles/code-ig...as-library
Someone wrote a code for easily integrate phpCAS into Codeigniter 2.X but it is no longer mantained nor updated to CI3.

For me, it is mandatory to use the CAS authentication method, any ideas on how to fix this error or use another alternative CAS client?

Thank you very much.
Reply
#2

Try:
Open your php.ini file with the File Manager in cPanel (if it is not exists create one)
Add the following line of code to top of your php.ini file
date.timezone = "US/Central"
Replace "US/Central" with the timezone that corresponds to the time you want to display.

http://www.php.net/manual/en/timezones.php
Reply
#3

Hello,

I do not have access to the php.ini file. Any other ideas? Don't you think it has something to do with how CI3.0 handles sessions? session_start() is php native whereas CI uses his own implementation of sessions. I think this could cause the issue but not sure how to fix it.

Thanks anyway.

(01-29-2016, 07:08 AM)moshair Wrote: Try:
Open your php.ini file with the File Manager in cPanel (if it is not exists create one)
Add the following line of code to top of your php.ini file
date.timezone = "US/Central"
Replace "US/Central" with the timezone that corresponds to the time you want to display.

http://www.php.net/manual/en/timezones.php
Reply
#4

(This post was last modified: 01-29-2016, 07:37 AM by josepostiga.)

Update your CodeIgniter root index.php file, like this:
PHP Code:
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */

 
   date_default_timezone_set('UTC');
 
   require_once BASEPATH.'core/CodeIgniter.php'

Of course, change UTC to your own timezone.
Best regards,
José Postiga
Senior Backend Developer
Reply
#5

(This post was last modified: 01-29-2016, 12:24 PM by moshair.)

Hello,

If you put a file php.ini in your website or in any folder it will change the php.ini default settings for values in it. Also if you contact the hosting support they may fix it in the server settings. This error related to the server more than the CI, I remember it happened with me before years and I was not using CI, using that php.ini solved it and now it seems it is fixed by the hosting company. Note: using custom php.ini file I think started with php 5.3.6.

Also you can try the solution by josepostiga.

Regards,



(01-29-2016, 07:27 AM)Mitteg Wrote: Hello,

I do not have access to the php.ini file. Any other ideas? Don't you think it has something to do with how CI3.0 handles sessions? session_start() is php native whereas CI uses his own implementation of sessions. I think this could cause the issue but not sure how to fix it.

Thanks anyway.

(01-29-2016, 07:08 AM)moshair Wrote: Try:
Open your php.ini file with the File Manager in cPanel (if it is not exists create one)
Add the following line of code to top of your php.ini file
date.timezone = "US/Central"
Replace "US/Central" with the timezone that corresponds to the time you want to display.

http://www.php.net/manual/en/timezones.php
Reply
#6

Done! The timezone error disappeared but the session_start() error keeps appearing. Any more ideas? Lost so many time with this issue...



Code:
A PHP Error was encountered

Severity: Error

Message: session_start() [function.session-start]: Failed to initialize storage module: user (path: C:\Windows\Temp)

Filename: CAS/Client.php

Line Number: 3620

Backtrace:


(01-29-2016, 07:36 AM)josepostiga Wrote: Update your CodeIgniter root index.php file, like this:
PHP Code:
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */

 
   date_default_timezone_set('UTC');
 
   require_once BASEPATH.'core/CodeIgniter.php'

Of course, change UTC to your own timezone.
Reply
#7

I have set permissions 777 to the directory C:\Windows\Temp and still have the same error. Any more ideas? Thanks.
Reply
#8

Well, I've given up with this issue. The only solution I found is to go back to CodeIgniter versión 2.x. Hopefully in the future this will be fixed. Thanks everyone.

(02-05-2016, 04:36 AM)Mitteg Wrote: I have set permissions 777 to the directory C:\Windows\Temp and still have the same error. Any more ideas? Thanks.
Reply
#9

Line 3620 of the CAS Client is in which method? What version of the client are you using? Have you tried another version?

Is the session library loaded before the CAS library?

The storage module "user" and the Windows temp path indicate that something other than CodeIgniter may be configuring the session handler. After all, with the CodeIgniter settings you've posted, there's nothing to indicate that the Windows temp path should be used. I'm also assuming that the and in your posted configuration was an attempt to highlight the values, rather than part of the actual values in your file.

There appear to be a few options to configure phpCAS' session handling, but they're not well documented, and may be relatively new additions to the code. It's possible that the library could be modified to initialize phpCAS to work properly with CI3, but it's probably something that would require someone familiar with phpCAS (or at least a valid testing environment) to figure out.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB