Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Troubleshooting › eStore – problems with sessions and headers after site migration to a new server
- This topic has 7 replies, 2 voices, and was last updated 5 years, 1 month ago by Rex Yul.
-
AuthorPosts
-
October 16, 2019 at 7:40 pm #15585Rex YulMember
Hi,
I’ve recently migrated my sites from a Cpanel server to a DirectAdmin server.
After the migration, my security plugin started to register a lot of PHP errors on the PHP ERROR LOG. All the errors registered in the log were concerning the WP ESTORE.
The errors were registered like this:
[15-Oct-2019 15:21:56 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /home/username/domains/lascositasdeamparito.com/public_html/wp-content/plugins/wp-cart-for-digital-products/wp_eStore1.php on line 5
[15-Oct-2019 15:21:56 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /home/username/domains/iwokis.com/public_html/wp-content/plugins/wp-cart-for-digital-products/wp_eStore1.php on line 5
[15-Oct-2019 15:21:56 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /home/username/domains/kroonskollektion.com/public_html/wp-content/plugins/wp-cart-for-digital-products/wp_eStore1.php on line 5
This type of error didn’t occur in the old Cpanel server (it wasn’t register by the security plugin).
The problem started after I migrated my sites to a new server using DirectAdmin.
Apparently, there’s something about the sessions and headers in wp_estore1.php on line 5 that is causing issues.
Do you have any idea of why my security plugin is registering this PHP error repeatedly?
Thanks for the support!
P.S I’ve tried to fix the problem by deactivating and activating the plugin again
October 17, 2019 at 1:27 am #80002adminKeymasterLooks like a PHP Session configuration issue on this new server. This is more like a server setup related issue. There seems to be a plugin that is outputting content too early (which is forcing the header to be sent before the session has started).
Can you do the following test keeping on the eStore plugin and see if the same error is there:
https://support.tipsandtricks-hq.com/forums/topic/test-to-identy-a-conflicting-theme-or-plugin
Also, do the following just to load a fresh copy of the plugin:
https://support.tipsandtricks-hq.com/forums/topic/re-install-or-load-a-fresh-build-of-the-plugins
October 17, 2019 at 6:54 pm #80003Rex YulMemberHi,
I followed the two steps you recommend. First, I deactivated and erased WP ESTORE. Then, I installed it again from the plugins page. This didn’t solve the problem.
Then. I deactivated all plugins and started to try to pinpoint one that could be conflicting. The error continue showing no matter what.
In any case, I think is odd that another plugin is conflicting with WP ESTORE, because in the old server none of the plugins conflicted with it (and the plugins are the same in both servers). Why would they start to conflict in the new server?
It could be a server configuration issue. But my host tells me the configuration on my old server is exactly the same that in the new server.
So I’m kind of lost here.
Any more ideas what could be the issue?
My host said this to me:
“The PHP handler in your source server is LSAPI which is not available on Directadmin without using LiteSpeed so I’ve set Directadmin to use PHP-FPM instead.”
Could that PHP-FPM be the culprit?
Also,
The database names changed during the migration. I don’t know if this could be responsible.
Thanks for the help!
October 17, 2019 at 11:03 pm #80004adminKeymasterThe database name won’t be the issue. This is a PHP problem that usually always happens for the following reason:
Outputting content too early (before the session starts or cookie related code is executed). Outputting even an empty space character too early will force the header to be sent and create this error.
At the moment, I feel that the PHP session feature is broken on this site. This error will happen as long as that condition exists (I was just assuming that there is another plugin that could be outputting some data too early). This really has nothing specifically to do about our plugin. This particular plugin of ours uses the PHP Session feature for it’s functionality.
I don’t really know what I can do from the plugin’s side of things.
October 18, 2019 at 12:39 am #80005Rex YulMemberHi,
Take a look at this link:
https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php
Apparently, PHP SESSIONS are very sensitive to white spaces (and other stuff)
I have been carefully examining the file wp_eStore1.php
And I have noticed this:
1. There is a white space right between the opening “<?php” tag and “if (version_compare(PHP_VERSION, ‘5.4.0’) >= 0) {“
2. I think there’s a missing php closing tag “?>” at the end of the file
Couldn’t be possible that the error is because of this whitespace or missing closing tag?
Maybe the PHP server of Cpanel bypass this whitespace, but the PHP server of DirectAdmin is not so permissive (it actually logs the whitespace as an error).
Maybe we can try see if this whitespace is triggering the problem with the session start and headers sent early.
It would also be good to see if there’s a missing php closing tag at the end of the file.
Just my two cents.
Thanks!
October 22, 2019 at 12:12 am #80006adminKeymasterThat space is not an echo. It is just the formatting in the code. That shouldn’t cause this issue.
October 23, 2019 at 8:44 pm #80007Rex YulMemberHi,
How about the PHP closing tag?
Or,
shouldn’t you use “===” instead of “==” when using Sessions?
Take a look at this:
October 24, 2019 at 11:39 pm #80008Rex YulMemberFor what is worth,
I noticed the error happens on PHP 7.2 (and 7.3), but not on PHP 5.6
I downgraded to PHP 5.6 and the error wasn’t being logged by my security plugin. But as soon as I went up to PHP 7.2, the error started being logged again.
This is likely due to how PHP 7.x handles the sessions, according to the error logs. When there’s a chunk of code that’s processing sessions earlier and a later piece of code tries to execute that, it usually results in a bad time, with errors.
Can you try to reproduce this on your services?
Thanks!
P.S I have made my host to recompile PHP 7.2 several times, and the error is still being logged by my security plugin
-
AuthorPosts
- You must be logged in to reply to this topic.