Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: Call to undefined function session_register() [duplicate]

Tags:

php

I have moved my site from php 5.3 to 5.4 and now I cannot login to site admin

I see this error:

PHP Fatal error: Call to undefined function session_register() in /home/regimhot/public_html/webmotionsV4/mvc/models/kit_model_useri.php on line 18

The code with the problem is:

        function login($username, $password) {
            if(!$username || !$password) return false;
            if($this->useri[$username]['password']==$password) {
                    session_register('userInfo');
                    $_SESSION['userInfo'] = $this->useri[$username];
                    $_SESSION['userInfo']['logat']  = true;
                    $this->userInfo = &$_SESSION['userInfo'];

How can I solve the problem? i know that the function session_register is not suported by php 5.4

like image 497
AndreiG. Avatar asked Dec 18 '13 15:12

AndreiG.


2 Answers

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

http://www.php.net/manual/en/function.session-register.php

Make sure you have session_start(), as just removing session_register() and relying on the $_SESSION assignment won't work.

like image 172
Connor Tumbleson Avatar answered Oct 19 '22 22:10

Connor Tumbleson


Per the documentation, the session_register() function was deprecated in version 5.3.0 and removed from PHP entirely in 5.4.0. I suspect that you're using version 5.4.0.

http://www.php.net/manual/en/function.session-register.php

like image 33
Julio Avatar answered Oct 19 '22 23:10

Julio