sseeley Posted May 27, 2010 Share Posted May 27, 2010 I hope someone can point me in the right direction. I am getting the following error message on my server and my Excel file will not create. It is working fine on my local machine, just not when I upload to my server. Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/mypcguy2:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/mypcguy2/public_html/accounts/PHPExcel/Writer/Excel5/Worksheet.php on line 299 Many thanks in advance for any help. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/203142-phpexcel/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 27, 2010 Share Posted May 27, 2010 You are apparently passing the file() statement an empty filename. You would need to troubleshoot why your code is doing that. Quote Link to comment https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064373 Share on other sites More sharing options...
sseeley Posted May 27, 2010 Author Share Posted May 27, 2010 It works perfectly on my local machine, so I can only see this as an error on the host server? Quote Link to comment https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064382 Share on other sites More sharing options...
sseeley Posted May 28, 2010 Author Share Posted May 28, 2010 I am getting a little further, it would seem this small peice of code is not allowed to write to a temporary directory, can anyone see where the problem might be? function _initialize() { // Open tmp file for storing Worksheet data $fileName = tempnam($this->_tmp_dir, 'XLSHEET'); $fh = fopen($fileName, 'w+'); if ($fh) { // Store filehandle $this->_filehandle = $fh; $this->_tempFilesCreated[] = $fileName; } else { // If tmpfile() fails store data in memory $this->_using_tmpfile = false; } } This is the error message? Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/mypcguy2:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/mypcguy2/public_html/accounts/PHPExcel/Writer/Excel5/Worksheet.php on line 299 Quote Link to comment https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064497 Share on other sites More sharing options...
PFMaBiSmAd Posted May 28, 2010 Share Posted May 28, 2010 A) $this->_tmp_dir is either empty or is set to a value that is outside of the open_basedir allowed path(s), B) Have you checked what is in $this->_tmp_dir to see why it might be causing that error, C) You can apparently ignore that warning because the code stores the data in memory if it cannot create a temporary file. Quote Link to comment https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064607 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.