• Hello.

    I’m running PHP Version 7.4.33.

    I’m seeing thousands of entries like these in my error log, mostly the second one:

    PHP Warning: session_start(): Cannot start session when headers already sent in /home/~/public_html/wp-content/plugins/participants-database/classes/PDb_Session.php on line 256

    PHP Warning: Cannot modify header information – headers already sent in /home/~/public_html/wp-content/plugins/participants-database/classes/PDb_Session.php on line 377

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xnau webdesign

    (@xnau)

    There are several reasons why thiscould happen, could be a misbehaving plugin or theme script. If you’ve got messages like this printing to the screen, that can cause these messages because printing to the screen sends the headers. Also can be because of a server configuration that prevents the plugin from using php sessions or cookies.

    I know that is all pretty technical, but the important thing here is are you seeing other problems?

    These messages are just warnings, they are not issues in themselves, but can indicate that other problems will come up.

    Thread Starter dougjoseph

    (@dougjoseph)

    Hello and thanks for replying. I am a developer with decades of coding experience, including expertise in PHP. My involvement here is as a volunteer helping a non-profit organization. The only action needed to cause this warning message to be thrown in the error log is to simply visit the WordPress site that has your plugin installed. The error message tells exactly which of your scripts is causing it. Specifically seems to be line 377 of “PDb_Session.php.” As I mentioned, the server in focus is running PHP Version 7.4.33. I’m not sure why your code would try to modify headers in such a case, but we’re not doing anything that should be causing any need for modifying the headers.

    Here is an example of a newly created warning generated just now by simply viewing the website’s home page, while the “Participants Database” plugin was installed and activated:

    PHP Warning: Cannot modify header information – headers already sent in /home/~/public_html/wp-content/plugins/participants-database/classes/PDb_Session.php on line 377

    Plugin Author xnau webdesign

    (@xnau)

    The plugin is attempting to write a cookie, which as you know is in the headers and therefore can’t be written after the headers are sent. The plugin doesn’t send the headers, it only writes a cookie, so some other script is sending the headers…or just outputting to the screen when it shouldn’t.

    Something to check on is are you seeing other problems? The warning is telling us that the plugin possibly can’t keep track of sessions, and so any functionality that relies on sessions (such as signups or frontend record editing) may be affected.

    You can try changing the “Use Alternate php Session Method” setting, that may help. This is in the plugin settings under the advanced tab.

    Thread Starter dougjoseph

    (@dougjoseph)

    Thanks for the additional info. The sites run by the non-profit have quite a few plugins, as you can imagine. If I get a chance to try to troubleshoot I will update if I can learn more. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Warnings: headers already sent’ is closed to new replies.