Fixing PHP Fatal error: Call to undefined function session_register()

While moving Website from older Debian 6 to Debian 7 server with Apache I encountered PHP Fatal error:

PHP Fatal error:  Call to undefined function session_register() in /var/www2/site/www/include/modules/core/session.class.php on line 7, referer: http://192.168.1.9/

In PHP newer than PHP 5.3, session_register(): function is obsolete, there is no need anymore to have this function initiated before using SESSION variables.

Comment out  in PHP files prompting error in Apache error.log everywhere where matched:

session_register();
session_register('session');

 

to look like this:
 

//session_register();
//session_register('session');

In newer PHP versions to initialize sessions:

 $_SESSION['session']="session_variable";

Before test it again in browser, restart Browser and Apache server to make sure some caching from Apache or Browser doesn't influence. That's all now site  works fine :)

Share this on

Download PDFDownload PDF

Tags: , , , , , , , , ,

Leave a Reply