July 15th, 2018, 01:20 AM
-
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
July 15th, 2018, 01:41 AM
-
Comment out the open_basedir line. Does your script work?
July 15th, 2018, 02:17 AM
-
Originally Posted by requinix
Comment out the open_basedir line. Does your script work?
comment out what? that line is not commented...!
July 15th, 2018, 02:45 AM
-
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.
July 15th, 2018, 03:08 AM
-
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.
July 15th, 2018, 03:09 AM
-
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
July 15th, 2018, 03:30 AM
-
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?
July 16th, 2018, 11:24 AM
-
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
July 16th, 2018, 12:06 PM
-
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?
July 17th, 2018, 01:25 AM
-
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?
July 17th, 2018, 02:39 AM
-
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?
July 17th, 2018, 02:59 AM
-
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
July 17th, 2018, 03:18 AM
-
Then that means your open_basedir setting is still being applied somewhere. You need to find it and remove it. Temporarily.
July 17th, 2018, 04:03 AM
-
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?
July 17th, 2018, 07:50 AM
-
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"?