Sonnich Posted June 18, 2020 Share Posted June 18, 2020 Hi all My code give this: <b>Warning</b>: file_exists(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/clients/........ I get the tmp folder and check for its existanse and whether it is writeable $t=sys_get_temp_dir(); writelog("t=$t"); if(file_exists($t)) writelog("t1=YES"); else writelog("t1=NO"); if(is_writable($t)) writelog("t2=YES"); else writelog("t2=NO"); Both gives no which is fine, I can process that. I do it to avoid the output above, but I still get that. How should I check for allowed paths? This runs on several systems where I cannot access php.ini or other system stuff. Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/ Share on other sites More sharing options...
gw1500se Posted June 18, 2020 Share Posted June 18, 2020 Check 'open_basedir' in your php.ini. Do you really want that? Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1578991 Share on other sites More sharing options...
Sonnich Posted June 18, 2020 Author Share Posted June 18, 2020 I used PHP 11 years ago and I move my clients stuff. I dont see php.ini, not might I have access to it on my clients's ISP's systems. Unless I can create php.ini myself and have it. Sorry, I dont know much here. Some guidelines please.... Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1578992 Share on other sites More sharing options...
gw1500se Posted June 18, 2020 Share Posted June 18, 2020 It should be /etc/php.ini. You will need root privileges to edit it. Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1578994 Share on other sites More sharing options...
Sonnich Posted June 18, 2020 Author Share Posted June 18, 2020 17 minutes ago, gw1500se said: It should be /etc/php.ini. You will need root privileges to edit it. Then I need something else... Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1578997 Share on other sites More sharing options...
requinix Posted June 18, 2020 Share Posted June 18, 2020 The temp dir really ought to be writable by PHP. You and/or your client should complain to the "ISP" or whoever manages their PHP setup to allow for that. Worst case: write to someplace other than /tmp. Like a dedicated log directory for your application. Oh. And this is something that should be configurable. Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1578999 Share on other sites More sharing options...
Sonnich Posted June 19, 2020 Author Share Posted June 19, 2020 8 hours ago, requinix said: The temp dir really ought to be writable by PHP. You and/or your client should complain to the "ISP" or whoever manages their PHP setup to allow for that. Worst case: write to someplace other than /tmp. Like a dedicated log directory for your application. Oh. And this is something that should be configurable. That will be my work around. My client want to move from this ISP to another, as there are other problems. Usually once a year the do something and we have remind them about rights etc. It usually takes them a week and a daily mail to react. After all, once I have copied their data out the will finish with this ISP Quote Link to comment https://forums.phpfreaks.com/topic/310959-how-do-i-check-for-file_exists-open_basedir-restriction-in-effect-filetmp-is-not-within-the-allowed-paths/#findComment-1579008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.