Home › Forums › All Other Themes › session_start function causing site health errors
- This topic has 3 replies, 2 voices, and was last updated 4 years, 2 months ago by Sonl Sinha.
-
AuthorPosts
-
August 17, 2020 at 8:36 pm #159404
Realestate theme causing issues on WP site health checks. I found this code and commented it out and that resolved the issue. However, I worry this may have adverse effects on the site. Can you please advise?
I get the 3 critical issue errors below…
An active PHP session was detected
Performance
A PHP session was created by a session_start() function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close() before making any HTTP requests.The REST API encountered an error
Performance
The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.
The REST API request failed due to an error.
Error: cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received (http_request_failed)Your site could not complete a loopback request
Performance
Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.
The loopback request to your site failed, this means features relying on them are not currently working as expected.
Error: cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received (http_request_failed)This is what I found to work around the error but as I mentioned above, I am not sure about any adverse affects this may have.
File: wp-content/themes/realestate/sktestate/skt-estate/inc/class-sktestate-submission.php
Line(s): 6
FIND
if ( ! session_id() ) { @session_start(); }
-CHANGE TO-
if ( ! session_id() ) { // @session_start(); }
With this not commented out, the site health report takes a long time to load. I assume this is because it has to timeout. Now with those lines commented, the site health report responds back with the report within a couple of seconds.
August 18, 2020 at 1:29 pm #159470Hi,
Kindly add this code:
Old code
if ( ! session_id() ) { // @session_start(); }
Replace to this code
if ( ! session_id() ) { session_start(); }
Regards,
DaveAugust 18, 2020 at 3:29 pm #159473That did not make any difference. It has the same resulting error. It will only work if I comment out the “session_start” line (line 6) of that file.
August 20, 2020 at 12:30 pm #159655Hi,
File:
wp-content/themes/realestate/sktestate/skt-estate/inc/class-sktestate-submission.php
Line(s): 6 Please delete following code ::
if ( ! session_id() ) { @session_start(); }
and after delete above code recheck site health. now critical issue resolved.
Regards,
Dave -
AuthorPosts
- You must be logged in to reply to this topic.