Jump to content

PHPExcel


sseeley

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/203142-phpexcel/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064497
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/203142-phpexcel/#findComment-1064607
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.