1
votes

Just transfered my installation to a new server. I'm having trouble debugging this, to my knowledge all permissions are still identical or MORE open than my old server on the folders that the server creates/reads files in...

From all I can tell, it's just that a temp file can't be created somewhere, but I have no idea where...

Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 346

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 347

Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 346

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 347

Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 346

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5/Worksheet.php on line 347

Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/myacnt/public_html/users/internal/PHPExcel/Shared/OLE/OLE_File.php on line 95

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/myacnt/public_html/users/internal/PHPExcel/Shared/OLE/OLE_File.php on line 96

Fatal error: Uncaught exception 'Exception' with message 'Can't create temporary file' in /home/myacnt/public_html/users/internal/PHPExcel/Shared/OLE/OLE_File.php:98 Stack trace: #0 /home/myacnt/public_html/users/internal/PHPExcel/Writer/Excel5.php(190): PHPExcel_Shared_OLE_PPS_File->init() #1 /home/myacnt/public_html/users/functions/export.php(58): PHPExcel_Writer_Excel5->save('/home/myacnt/...') #2 /home/myacnt/public_html/users/manager/functions/export.php(196): multiCSVToExcel(Array, '1305481112_Nick...') #3 /home/myacnt/public_html/users/manager/viewInvoice.php(13): exportInvoiceLog(Array) #4 {main} thrown in /home/myacnt/public_html/users/internal/PHPExcel/Shared/OLE/OLE_File.php on line 98

2

2 Answers

2
votes

You're dealing with a restriction called open_basedir as indicated by your error message. You either have to check the value in php.ini (you can use phpinfo() to check this quickly) and put files in the directory indicated, modify the value, or simply disable it entirely. If you disable it, you'll need to make sure to do sanity checks on filenames, such as using basename to remove potential "../../" traversal.

2
votes

This fix worked for me:

http://phpexcel.codeplex.com/workitem/17840

The changes must be applied to Shared/File.php