This topic is locked

PHP Warning: session_set_cookie_params(): Cannot change session cookie parameters

8/14/2024 12:54:44 AM
PHPRunner General questions
J
jackolantern author

Hi, anyone can help

How to solve this error.

PHP Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in /home/besn/public_html/rewards/include/dbcommon.php on line 12

dbcommon included in external files.

Thank you

J
jackolantern author 8/14/2024

Error happen when running script/page that using dbcommon.php

C
cristi 8/14/2024

Without code posted I can only guess:

  • Is there any blank space or new line before <?php tag in your external file ?
  • Encoding?
  • Are your echoing some html code before the php code?
  • what editor was used for the external php files?
  • also how about your closing ?>. From the php manual: "If a file contains only PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script. "

The ideea is that your external file is to blame and not dbcommon.php - so post the code for your external file