Warning: Unknown: Your Script Possibly Relies on A Session Side-effect

in Web Development

I’ve said before, curently I’m doing website migration from my temporary hosting to my current hosting at innohosting. I have to make some adjustments in order to avoid some errors caused by differences in the server.

Some of the errors that I found were:

  • Wordpress : You Do Not Have Sufficient Permissions to Access This Page. The most common cause of this error is a wordpress upgrade that didn’t complete or/and the changed of table prefix on the migration process. This error solved
  • Wordpress Database Management plugin : WP-DBManager fails to backup database, makes 0 kb backup file and Fatal error: Allowed memory size of 33554432 bytes exhausted solved here
  • Warning: mysql_real_escape_string(): Access denied for user: ‘nobody@localhost’ etc. Found a fix : change all the mysql_real_escape_string to mysql_escape_string
  • Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_
    compat_warn to off, respectively. in Unknown on line 0. Here we are now to solve this problem

I get this warning at the bottom of my membership page when I tried to logging in. This error caused by old methode used by my script.  Innohosting is using PHP 5 (latest PHP).

How to Solve Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3?

I found the solution here: http://www.daniweb.com/forums/thread190425.html

If you are using the session_register(“name”); You need to upgrade it to the $_SESSION['name'] = $name;.

So..I make some modifications to my old script

session_start ();
session_register ('password_session');
session_register ('id_ses');
$password_session = md5(uniqid(rand(),true));
$id_ses = $rs->id;
$loncat = 'member/index.php';

My new script

session_start ();
$password_session = md5(uniqid(rand(),true));
$id_ses = $rs->id;
$_SESSION('password_session') = $password_session;
$_SESSION('id_ses') = $id_ses;
 $loncat = 'member/index.php';
 

Now my script working properly without changing php.ini, but as an alternative you can add the below code to php.ini to eliminate the error:

session.bug_compat_42 = 1
session.bug_compat_warn = 0
Use the social buttons below to add it on your favorite social sites to get the latest updates. Not sure about these options? Learn more about RSS and social bookmarking

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Comment

Previous post:

Next post: