PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.2k forks source link

File(/tmp) is not within the allowed path(s) #1322

Open supertorpez opened 6 years ago

supertorpez commented 6 years ago

How i can solve this problem??

File(/tmp) is not within the allowed path(s)

Thanks

ComServ commented 6 years ago

I'm having the same Problem

ComServ commented 6 years ago

After a bit of hacking.... commented out line 178 in PHPExcel/shared/file.php and lo the file is written. // use ordinary built-in PHP function // There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only // be called if we're running 5.2.1 or earlier //myhack // Running PHP 7.0.24 and receiving Error 'File(/tmp) is not within the allowed path(s)' // Commented out the following line and the Error disappears.... why? Who knows. //return realpath(sys_get_temp_dir());

ComServ commented 6 years ago

The real cause of the Problem: temp_dir not set in php.ini. If you have no access to php.ini you can try to set the variable on runtime with putenv('TMPDIR=/foo/bar'); (Works only if php not in safe mode)