PHP open_basedir error

10,257

open_basedir limits the files that can be opened by PHP within a directory-tree.

You should config session.save-path to some path inside

C:\Users\Administrator\Desktop\website\

Or add the session directory to the list of folders that PHP script can access

session.save-path = "C:\Windows\TEMP\"

open_basedir = "C:\Users\Administrator\Desktop\website\;C:\Windows\TEMP\"

Share:
10,257

Related videos on Youtube

Chris
Author by

Chris

I'm a senior full-stack web developer and I am currently working with the creation of the UI for various surveillance systems at Axis Communications AB. Before my career I studied Computer Science & Engineering at Lund University, Sweden. I also hold a certificate in Business Management & Marketing. I've always been interested in software development and everything that it entails. All of it. Not just the programming aspect, which is why I don't like being called a "programmer", even though ~80% of my job routine consists of coding. I've been doing this professionally for about 7 years, and for private/hobby purposes for over 12 years. Though I like working with most languages and platforms, I have an undeniable preference towards web technologies. I like working with php and node.js. However, I love javascript and related frameworks; especially React.js, in which I often find myself spending an inordinate amount of time answering questions here on Stack Overflow. In fact, I'm currently listed in the react.js Leaderboards! Oh, and I'm also a huge aviationphile; meaning I love everything related to aviation, airplanes and even space! I'm currently studying towards my PPL certificate (ASEL rating) which takes up most of my spare time.

Updated on June 04, 2022

Comments

  • Chris
    Chris almost 2 years

    Been trying to install php today and I ran into this problem when trying to launch my website:

    PHP Warning:  session_start(): open_basedir restriction in effect. File(C:\Windows\TEMP) is not within the allowed path(s): (C:\Users\Administrator\Desktop\website) in C:\Users\Administrator\Desktop\website\bootstrap.php on line 21
    

    I have set my php.ini to the following settings:

    open_basedir = "C:\Users\Administrator\Desktop\website\"
    

    and

    upload_tmp_dir = "C:\Windows\TEMP\"
    

    I tried changing the directory for upload_temp_dir to C:\Users\Administrator\Desktop\website\temp but the error keeps telling me that C:\Windows\TEMP is not valid - even though I changed the dir.

    Any ideas? Thanks.

    EDIT:

    Now I am getting:

    PHP Warning:  session_start(): open(C:\Windows\TEMP\\sess_ca0ea257d89dfecd355e375071e30d7e, O_RDWR) failed: Permission denied (13) in C:\Users\Administrator\Desktop\website\bootstrap.php on line 21
    

    PHP Warning: Unknown: open(C:\Windows\TEMP\sess_ca0ea257d89dfecd355e375071e30d7e, O_RDWR) failed: Permission denied (13) in Unknown on line 0 PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Windows\TEMP) in Unknown on line 0

    • Joseph
      Joseph almost 10 years
      after you change the upload_tmp_dir, did you restart the apache service?
  • Chris
    Chris almost 10 years
    Ok now I am getting Permission denied. I tried both approaches.
  • Droga Mleczna
    Droga Mleczna almost 10 years
    Does the account that your web server is running have write permissions on C:\Windows\Temp ?