PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Excel_Writer "Can't create temporary file"

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Installation, Upgrading & Configuration
View previous topic :: View next topic  
Author Message
factorypolaris



Joined: 09 Apr 2008
Posts: 2

PostPosted: Wed Apr 09, 2008 4:53 am    Post subject: Excel_Writer "Can't create temporary file" Reply with quote

Hello,

I have installed pear Excel_Writer. I have used the writer before and it works great on some of my domains. However on a new project I get the following error in the .xls file. (Can't create temporary file). The two projects are running on the same machine in the same php.ini enviorment.

I have ensured there is enough allocated disk space and also checked file permissions but with no luck. (folder permissions in the directory the php script is running) Same Error.

I have found a function to set the temporary file but cant seem to get it to work. Here is whats listed in the Docs:

setTempDir [line 569]

true setTempDir( string $dir)


Sets the temp dir used for storing the OLE file

Return: if given dir is valid, false otherwise
Access: public


Parameters:
string $dir — The dir to be used as temp dir



If anyone could help me implement this into my script I think this might solve the issue. Or if you know what else I could try, it would help me very much.

Just for testing I have been using the following script.
Code:
<?
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'PEAR.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);

// Include PEAR::Spreadsheet_Excel_Writer
require_once "/usr/share/pear/Spreadsheet/Excel/Writer.php";



// Create an instance

$xls =& new Spreadsheet_Excel_Writer();
// Send HTTP headers to tell the browser what's coming
$xls->send("test.xls");

// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');

// Write some numbers
for ( $i=0;$i<11;$i++ ) {
 // Use PHP's decbin() function to convert integer to binary
 $sheet->write($i,0,decbin($i));
}

// Finish the spreadsheet, dumping it to the browser
$xls->close();
?>




Thanks,
Chris
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Wed Apr 09, 2008 8:57 am    Post subject: Reply with quote

Well, you simply need something like the following:

Code:

$xls->setTempDir('/your/temp/dir');


BTW, your require_once call might cause more problems. It is recommended to just use
Code:
require_once "Spreadsheet/Excel/Writer.php";
and to adjust the include_path accordingly.
Back to top
View user's profile Send private message
factorypolaris



Joined: 09 Apr 2008
Posts: 2

PostPosted: Thu Apr 10, 2008 4:25 am    Post subject: Reply with quote

I have tried that and it still will not write to any of my tmp directories. However I did get it working by turning Safe Mode to Off. For some reason I have not been able to get it working with safe mode on. I have found this same thing with other pear extentions. The Excel Writer is very nice once you get it working. Well worth the effort of getting it going if you are having a hard time getting it to run for the first time.

Also, I have updated my include path to accomodate the short directory name. The include path had not been set for PEAR.

Thanks for you help.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Thu Apr 10, 2008 10:42 am    Post subject: Reply with quote

factorypolaris wrote:
I have tried that and it still will not write to any of my tmp directories. However I did get it working by turning Safe Mode to Off. For some reason I have not been able to get it working with safe mode on.


I'm using this package on several servers, some of them with safe_mode enabled. Using setTempDir() was needed in all this cases, but solved the problem very well.

Have you made sure that the webserver user has write permissions to the temporary directory? Otherwise, it can't work with safe_mode enabled.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Installation, Upgrading & Configuration All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software