This is an issue that occurred when I attempted to run a PHP web application on a Windows IIS server (using PHP 5.6). The error was as follows:
Warning: session_start(): open_basedir restriction in effect. File(C:WindowsTEMP) is not within the allowed path(s)
Basically, the function session_start was attempting to write session data to the Windows temporary folder. However, this failing because the open_basedir directive in my php.ini file was restricting PHP’s access to the the inetpub directory on my C: drive. This leads to the following warning:
Fatal error: session_start(): Failed to initialize storage module
To fix the issue, I opened up my php.ini file and commented out the open_basedir directive. To do this, you can simply:
- Open your php.ini file.
- Find the line with open_basedir on it.
- Comment out the line by placing a semi colon (;) at the start of it.
- Save your changes.
- Restart your web server (whether it is IIS or Apache or Nginx).
An example of what the line should look like if you comment it out properly:
;open_basedir = C:inetpub
Hopefully, this article spared you from a headache or two!