Ahmad Albab
Ahmad Albab

Reputation: 31

PHP Warning: session_start(): Failed to read session data: files (path: C:\inetpub\tmp) - Windows Server 2016

I got problem when I transfer my PHP files to Windows Server. The error that I found is:

PHP Warning: session_start(): open(C:\inetpub\tmp\sess_ls40vhrbgus8ghmqvnqrat2qfo, O_RDWR) failed: Permission denied (13) in C:\inetpub\wwwroot\ebooking\index.php on line 4

and below is my code:

index.php

include("config/configPDO.php");
session_start(); //line 4

$msg = ""; 
if(isset($_POST['submitBtnLogin'])) {
$User_ID = trim($_POST['Email']);
$email=explode('@',$User_ID);
if (is_array($email)){
    $User_ID=$email[0];
}

But when I just code echo "Hello World", the text will display. No problem.

Can I know what the problem? Is there any configuration that i need to do in php.ini?

Upvotes: 2

Views: 13394

Answers (2)

Jokies Ding
Jokies Ding

Reputation: 3494

IIS activate PHP_CGI via application pool identity. So please try to grant your authenticated user like IUSR and application pool identity(IIS Apppool\apppool name) read/write permission to access the C:\inetpub\tmp.

If steps above is not working, please try to use process monitor in this case. Create a filter to access denied error. And then it will tell us who and where to grant permission.

https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

Upvotes: 2

Dilip Hirapara
Dilip Hirapara

Reputation: 15306

Change session path where you can write data or contact server administrator about /tmp problem

http://php.net/manual/en/function.session-save-path.php

you will need to change your session.save_path php.ini directive

Upvotes: 0

Related Questions