munk.me.uk forum
May 21, 2012, 05:28:35 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Some error occur  (Read 533 times)
simontkk2005
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


View Profile Email
« on: March 02, 2011, 09:06:36 am »

hi guys.I`m simon from malaysia which currently doing my degree program. And i`m just start to learn PHP The problems that my system shown is like below:

Deprecated: Function session_register() is deprecated in C:\xampplite\htdocs\simpleauth\config.php on line 84

Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\xampplite\htdocs\simpleauth\config.php:84) in C:\xampplite\htdocs\simpleauth\config.php on line 84

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at C:\xampplite\htdocs\simpleauth\config.php:84) in C:\xampplite\htdocs\simpleauth\config.php on line 84

Deprecated: Function session_register() is deprecated in C:\xampplite\htdocs\simpleauth\config.php on line 85

Deprecated: Function session_register() is deprecated in C:\xampplite\htdocs\simpleauth\config.php on line 86

May i know what make this problems occur Huh
thx for helping me...
Logged
munk
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 368


View Profile WWW
« Reply #1 on: March 02, 2011, 10:22:40 am »

Hi Simon,

There's only me really that uses/replies to anyone nowadays, really I don't work with PHP much any more and should probably shut the forum down and remove the scripts to be honest.  I will try and help though if I can.

The problem you're having is to do with the simpleauth scripts using an old function (session_register()) that is no longer the 'best practice' to use in newer versions of PHP.

There are two options - either change your server's php configuration so that it does not show strict messages or change the code so that it doesn't use session_register().  The latter option is probably for the best, although if you constantly get deprecated messages then you might want to disable strict messages in your php configuration file.

To fix the code, try removing the session_register() lines from config.php and perhaps replace it with a single session_start() call.  It might even work without the session_start() call because you are using the $_SESSION array variable throughout the scripts and I think session_start() is implicitly called when you do that anyway.  I might be wrong though, like I say I don't work with PHP any more!

Alternatively to stop strict error messages being displayed you would have to change your PHP configuration (php.ini file) so that it does not display strict error messages.  See here:

http://php.net/manual/en/errorfunc.configuration.php#ini.error-reporting

if you read that page you will see this:

Quote
    Note:

    In PHP 5 a new error level E_STRICT is available. As E_STRICT is not included within E_ALL you have to explicitly enable this kind of error level. Enabling E_STRICT during development has some benefits. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions.

The highlighted bit is what's making PHP show you the deprecated message (the script itself will still work if you don't display the strict warning about deprecated functions, but it's probably best to leave it in and fix the code if you can).
Logged

~ Jez
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!