putenv() has been disabled for security reasons

I add my project in htdocs and when I tried to load the website it gives me this error

Warning: putenv() has been disabled for security reasons in /home/vol2_6/epizy.com/epiz_20573883/htdocs/vendor/vlucas/phpdotenv/src/Loader.php on line 344s

Yes, putenv() has been disabled for security reasons, so you get the error putenv() has been disabled for security reasons. And because of security reasons, you cannot enable it.

I managed to find another way but there another probelm

I uploaded my files via FTP and put them in htdocs file and I go to my website example.com/public and it works just fine but when I moved all my files to the root directory and my public content to htdocs and reload the website I get this error

Warning: require(): open_basedir restriction in effect. File(/home/vol2_6/epizy.com/epiz_20573883/bootstrap/autoload.php) is not within the allowed path(s):(/php_sessions:/tmp:/var/
www/errors:/usr/share/pear :/home/vol2_6/epizy.com/epiz_20573883/htdocs) in /home/vol2_6/epizy.com/epiz_20573883/htdocs/index.php on line 22

Warning: require(/home/vol2_6/epizy.com/epiz_20573883/bootstrap/autoload.php): failed to open stream: Operation not permitted in /home/vol2_6/epizy.com/epiz_20573883/htdocs/index.php on line 22

Fatal error: require(): Failed opening required ‘/home/vol2_6/epizy.com/epiz_20573883/htdocs/…/bootstrap/autoload.php’ (include_path=‘.:/usr/share/pear/’) in /home/vol2_6/epizy.com/epiz_20573883/htdocs/index.php on line 22

For security reasons, your website cannot access files outside the htdocs folder. All files used in your website must be located in the htdocs folder?

Are you using Laravel by any chance? If so, you can just copy the content of the public folder to the root folder and then upload that to the htdocs folder on your account.

yes I’m using Laravel, I did upload the content of the public folder to htdocs but why should I copy it to the root folder?? I have a public folder in the root also and I tried to copy the content of the public to the root and still gives me the same error

@Mouhamad said:
yes I’m using Laravel, I did upload the content of the public folder to htdocs but why should I copy it to the root folder?? I have a public folder in the root also and I tried to copy the content of the public to the root and still gives me the same error

Sorry, I guess my folder naming is a bit confusing.

Best I can tell from the error messages, you have taken the main Laravel directory (with the app, bootstrap, database, etc. folders in it) and uploaded it to the main directory of your hosting account (possibly renaming the public folder to htdocs). The routing script tries to get the content from outside the htdocs folder, but that’s not possible due to the open_basedir restriction.

What you could do instead is take the index.php and the other stuff in the public directory in your Laravel folder and copy it to the root folder of your Laravel installation. You’ll also have to edit the include paths in the index.php file.

Then, you can upload the Laravel installation folder to the htdocs folder on your hosting account. That way, all files used by Laravel will be in the htdocs folder so PHP is allowed to access those files.

I hope I’ve explained it correctly now.

I did what you told me but this creates another problem and that the user can access all my website files. and the website now doesn’t 404 page not found all the Laravel project is now ruined. the Laravel project need to put the public file in htdocs and all other files in the root directory

@Mouhamad said:
I did what you told me but this creates another problem and that the user can access all my website files. and the website now doesn’t 404 page not found all the Laravel project is now ruined. the Laravel project need to put the public file in htdocs and all other files in the root directory

Laravel seems to be working fine here: http://laravel-demo.rf.gd/login

Just make sure you edit the paths in the index.php file properly and copy everything from the public folder to the root dir.

You that anyone can acess all the project files.
Try this http://laravel-demo.rf.gd/app

@Mouhamad said:
You that anyone can acess all the project files.
Try this http://laravel-demo.rf.gd/app

That’s the case with most PHP sites, and the case with all sites hosted here (because you can’t place code outside the htdocs directory). You can try to access the files, but none of the files will actually show you anything. And adding an Options -Indexes rule to your .htaccess file will block directory browsing as well. So I don’t think it’s a problem.