Problem: How to fix session_start() error

The Problem:
You get a session_start error and it references a si-contact-form.php file. The error may or may not be accompanied by messages referencing “Warning: session_start()” depending on whether the server has show errors turned off so they are never displayed even when triggered.

The Cause:
The problem is that PHP sessions are currently not working on your server and the cookie cannot be set. The PHP server is not allowing the session to start and the error is how you find out.

The Solution:

The 3.1.x versions had PHP sessions enabled by default. The 4.xx version does not use PHP sessions at all unless you enable the setting “Use PHP Sessions” on the “Advanced” tab in the form settings.

If you have the 3.1.x version:
Upgrade to the 4.x version and the error should go away(unless some other plugin or theme is causing it).

If you have the 4.x version:
Uncheck the setting “Use PHP Sessions” on the “Advanced” tab in the form settings. Then the error should go away(unless some other plugin or theme is causing it).

Fix it at the server level:
Make a trouble ticket with your web host. Ask them to fix the broken PHP session feature of the web server. It will better help them resolve the problem if you include the error message and a URL to your page with the error on it. They can create the proper temporary folder needed for PHP sessions. If the folder is already there, they can check and make the necessary adjustments to the folder permissions or group ownership. Then the sessions will work as they should.

The explanation:

The error is similar to this (the line numbers and directory may even be slightly different)
Warning: session_start() [function.session-start]: open(/tmp/sess_aa3rmj2iquntm19df3d2higua3, O_RDWR) failed: No such file or directory (2) in /wp-content/plugins/si-contact-form/si-contact-form.php on line 1795

Or the error is similar to this (the line numbers and directory may even be slightly different)
Warning: session_start() [function.session-start]: open(/tmp/sess_aaa16408141656d9755cf49548472883, O_RDWR) failed: Permission denied (13) in /wp-content/plugins/si-contact-form/si-contact-form.php on line 1810

Also, it may or may not be followed by these two other errors:
Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

The first error is the cause, the other two are effects of the first error. There is nothing wrong with the plugin code. This plugin is just asking the PHP server to open a session to set a cookie. The problem is that PHP sessions are currently not working on your server and the cookie cannot be set. The PHP server is not allowing the session to start and the error is how you find out.

The error is telling you that it cannot open the required session temporary folder because the folder does not exist or that the permissions or ownership is incorrect. This is purely a server misconfiguration, not a program error with the plugin. Ask your web host to fix the broken PHP session feature of the web server.

Enable WP Debug for Advanced troubleshooting:
If your server has errors turned off so they are never displayed even when triggered, here is how to turn on the error display to assist your web host in fixing the server:
FTP to your web server folder where WordPress is installed, then edit the wp-config.php file and add this line:
define(‘WP_DEBUG’, true);

A good place to add it is after the $table_prefix line

Be sure to remove it later when done testing as some poorly written plugins and themes will display warnings or errors all the time.

Do you need help?

Send us a Donation:

Donate to Mike Challis

Comments are closed.