#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6

    Open_BaseDir function in plesk windows server not working.


    hi, i am trying to access files outside of domain root dir.

    i know php can handle that.

    please check following image:

    Plesk.png

    i update/set in plesk to add the additional directory.

    then i also check the .user.ini file, that folder is also there:
    Code:
    open_basedir="C:/Inetpub/vhosts/myDomain.com\;C:\Windows\Temp\;C:\DLoads\"
    but still when i try to run my php file/script it throws following error:

    Code:
    PHP Warning:  filesize(): open_basedir restriction in effect. File(c:\DLoads\Test.txt) is not within the allowed path(s): (C:/Inetpub/vhosts/myDomain.com\;C:\Windows\Temp\;C:\DLoads\) in C:\Inetpub\vhosts\myDomain.com\httpdocs\t5.php on line 3
    below is my sample php script:
    Code:
    $file = 'c:\DLoads\Test.txt';
    echo filesize($file);
    so, what did i miss? what else setting i need to change to accept that?

    is any ISS config missing?

    thanks in advance
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Comment out the open_basedir line. Does your script work?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Comment out the open_basedir line. Does your script work?
    comment out what? that line is not commented...!
  6. #4
  7. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Find the line of something that has to do with open_basedir. There is only one. You posted it. That is the line I am talking about.

    And comment it out. Because it is not currently commented out. As you pointed out. Make it be commented out and try your script.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Find the line of something that has to do with open_basedir. There is only one. You posted it. That is the line I am talking about.

    And comment it out. Because it is not currently commented out. As you pointed out. Make it be commented out and try your script.
    i am sorry but i really not getting you!

    .user.ini file has following line:

    Code:
    open_basedir="C:/Inetpub/vhosts/myDomain.com\;C:\Windows\Temp\;C:\DLoads\"
    and that is not commented.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Find the line of something that has to do with open_basedir. There is only one. You posted it. That is the line I am talking about.

    And comment it out. Because it is not currently commented out. As you pointed out. Make it be commented out and try your script.
    and also please check the php error, it also shows the path that my script tries to access. but fails
  12. #7
  13. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Originally Posted by zakir_szh
    and that is not commented.
    Comment. It. Out.

    Make it be commented.

    Make it cease to be not commented.

    How many other ways do I have to say this?
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Comment. It. Out.

    Make it be commented.

    Make it cease to be not commented.

    How many other ways do I have to say this?
    ok.. now i have set the value in .user.ini file like this:

    Code:
    ;open_basedir="C:/Inetpub/vhosts/siamcomputer-cloud.com\;C:\Windows\Temp\;C:\DLoads\"
    i mean comment it with ; character.. but still same php error

    any help please?

    best regards
  16. #9
  17. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Either you didn't comment out the line like you say you did, or the same open_basedir setting it being applied somewhere else you are presumably unaware of, or your claim that you get the same error message is... less than factual.

    So which is it?
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Either you didn't comment out the line like you say you did, or the same open_basedir setting it being applied somewhere else you are presumably unaware of, or your claim that you get the same error message is... less than factual.

    So which is it?
    ok.. yes.. i agree that i am very new/novice in case of server setting but i know what i am talking about? so, at last resort i think if you really want to help me, then can you give me 5 minutes and get access to my computer via teamviewer etc and check/see your self?
  20. #11
  21. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Change your code
    PHP Code:
    $file 'c:\DLoads\Test.txt';
    echo 
    filesize($file); 
    to
    PHP Code:
    echo "open_basedir="ini_get("open_basedir");
    $file 'c:\DLoads\Test.txt';
    echo 
    filesize($file); 
    What does it say and what is the error message?
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Change your code
    PHP Code:
    $file 'c:\DLoads\Test.txt';
    echo 
    filesize($file); 
    to
    PHP Code:
    echo "open_basedir="ini_get("open_basedir");
    $file 'c:\DLoads\Test.txt';
    echo 
    filesize($file); 
    What does it say and what is the error message?
    first of all thanks a lot for your eagerness to help me out (sorry for giving the thanks bit lately)

    then here is the screenshot of browser response:

    Browser-1.png

    PHP-1.png

    and here is the error message from error log file:
    Code:
    [17-Jul-2018 06:51:25 UTC] PHP Warning:  filesize(): open_basedir restriction in effect. File(c:\DLoads\Test.txt) is not within the allowed path(s): (C:/Inetpub/vhosts/myDomain.com\;C:\Windows\Temp\;C:\DLoads\) in C:\Inetpub\vhosts\myDomain.com\httpdocs\t5.php on line 4
    thanks in advance

    best regards
  24. #13
  25. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    Then that means your open_basedir setting is still being applied somewhere. You need to find it and remove it. Temporarily.
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    65
    Rep Power
    6
    Originally Posted by requinix
    Then that means your open_basedir setting is still being applied somewhere. You need to find it and remove it. Temporarily.
    any help to find out that? because find text in all .ini files in c drive will take forever..

    i though run phpinfo() on that domain path.

    it shows, it only use "C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP56\php.ini " file..

    i open that file in notepad and there it is also commented

    any luck for me sir?
  28. #15
  29. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,885
    Rep Power
    9646
    I don't know where you have open_basedir defined. phpinfo() will show you included INI files but the setting can be changed to a limited degree with ini_set().

    Perhaps search everywhere for "DLoads"?

IMN logo majestic logo threadwatch logo seochat tools logo