Jump to content

Warning: file_exists(): open_basedir restriction in effect. File


kako0000000

Recommended Posts

i used this code

 

ob_start(); // start output buffering => this allows us to keep the behavior of the script identical on all systems.
define("DRSR", $_SERVER['DOCUMENT_ROOT']);
define("FDSR", str_replace("\\","/",dirname(__FILE__)));
// Determine if the script is inside a subfolder, if it is, isolate the subdirectory from the root path and store it in a Constant
// this allows links to be relative to the script, even if it is moved.
if(dirname(DRSR) === dirname(FDSR)){
	define("DIRREC", "");
}else{
	define("DIRREC", str_replace(DRSR,"",FDSR));
}
//allow the script to include files restricted to normal users:
define("SFR_INC_0_LKEY", true);
//set the session-related settings to avoid other scripts from messing with these sessions
if (!file_exists(session_save_path().DIRREC.DIRECTORY_SEPARATOR.'Autofaucet')){
	mkdir(session_save_path().DIRREC.DIRECTORY_SEPARATOR.'Autofaucet', 0777, true);
}
    session_save_path(session_save_path().DIRREC.DIRECTORY_SEPARATOR.'Autofaucet');

then i run show error me

 

Warning: file_exists(): open_basedir restriction in effect. File(/opt/alt/php80/var/lib/php/session/Autofaucet) is not within the allowed path(s): (/var/home/btcearns/public_html:/usr/lib/php:/usr/local/lib/php:/tmp) in /var/home/btcearns/public_html/index.php on line 31

Warning: mkdir(): open_basedir restriction in effect. File(/opt/alt/php80/var/lib/php/session/Autofaucet) is not within the allowed path(s): (/var/home/btcearns/public_html:/usr/lib/php:/usr/local/lib/php:/tmp) in /var/home/btcearns/public_html/index.php on line 32

Warning: session_save_path(): open_basedir restriction in effect. File(/opt/alt/php80/var/lib/php/session/Autofaucet) is not within the allowed path(s): (/var/home/btcearns/public_html:/usr/lib/php:/usr/local/lib/php:/tmp) in /var/home/btcearns/public_html/index.php on line 34

what problem

 

 

Link to comment
Share on other sites

These messages are all related to the open_basedir settings of your php installation.

You need to locate the php.ini file for your system.    Either a script that only has phpinfo(); in it, or use of cli php run with php -i will let you see where the configuration file(s) are located.  On most systems, the base php.ini will load files in a subdirectory like /etc/php.d. You can ignore those files if they do exist, as the open_basedir configuration will be in the main php.ini script.

The first place to look would be /etc/php.ini, but you need to be sure that you are editing the actual php.ini being loaded when you run your script.  In some cases, there are different php.ini files so that php used with a web server can be configured differently from the cli version you use to run command line scripts with.  Once you are sure you are changing the correct php.ini, edit it with a text editor and look for the line

open_basedir = 

You can either add the directories in question to the list you find, or disable it entirely by adding a ; before the line like this:

;open_basedir = 

If this script is being run through a webserver, then you would want to restart the web server, or possibly php-fpm, if that is your web server configuration.  If this is a cli script, running it again after you added the directories or disabled open_basedir should solve the issue.

Link to comment
Share on other sites

18 hours ago, requinix said:

I can't think of a reason this code should be in place: it modifies where PHP stores session files, which PHP is quite capable of handling by itself.

Why do you think you need this code?

Gonna throw out my best guess here, based on the snippet and some variable naming, that OP has gotten a script designed to be run from the cli, that automates interaction with some crypto faucets.  OP didn't write the app, doesn't really know PHP, isn't likely to learn it, and is just trying to run this script to get it running as a means to an end.  Script contains features designed to isolate it from anything else that might be running on a server offering PHP.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.