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 
Temporary File Storage Directory

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



Joined: 11 Aug 2008
Posts: 4

PostPosted: Mon Aug 11, 2008 6:24 pm    Post subject: Temporary File Storage Directory Reply with quote

To preface: I did not set up Pear on the system that I am administrating nor do I have more than cursory familiarity with the Pear system; that being said, I am an experienced developer and educable in such matters.

The ExcelWriter module is being used in the PHP-based software system I am working with; the files that the system produces using that module are being written to /tmp, the temporary partition on the Linux file system. A problem has arisen insofar as that these files are numerous and of not inconsiderable size, and have begun to completely fill the partition. They're still being accessed, which prevents me from taking the simple step of removing them.

Would the logic telling the system where to save these files to be some default in the configuration file for PEAR, or for PHP, or is this directory choice assigned specifically on a case-by-case basis? I'm just not sure where to start looking, to update the software to write these files to a specifically set-aside area on a much larger partition. Any insights that could be provided would be wholeheartedly appreciated.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1004

PostPosted: Mon Aug 11, 2008 10:39 pm    Post subject: Reply with quote

I doubt that the files are still accessed. In fact, they are usually removed once the Excel file was generated. (That's at least the behaviour that I know from various installations of the Excel writer package.)

You can change the directory that is used by the OLE package via SEW's setTempDir() method:
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-workbook.settempdir.php

The Worksheet class also generates temporary files, but setTempDir() has no effect on these files. If you don't like the usage of PHP's tmpfile() function (and its choice of the temporary directory), you can disable the usage of temporary files by the Worksheet class by setting the (private!) property $_using_tmpfile to boolean false.
Back to top
View user's profile Send private message
Kevin Barsotti



Joined: 11 Aug 2008
Posts: 4

PostPosted: Wed Aug 13, 2008 12:27 pm    Post subject: Reply with quote

If there were not evidence in access logs on the server file system to indicate that the files are seeing recent use (ones created weeks ago were last accessed hours or days ago) I would not be so concerned about delicate handling of the problem; I will look into setTempDir() in order to give the files a larger area to reside.

What I suspect is happening is that the files are generated in the temp directory, delivered once, but subsequent attempts to generate and deliver them first check their existence and, in the event that they are found, retrieves rather than generating them anew.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1004

PostPosted: Wed Aug 13, 2008 9:30 pm    Post subject: Reply with quote

Kevin Barsotti wrote:
If there were not evidence in access logs on the server file system to indicate that the files are seeing recent use (ones created weeks ago were last accessed hours or days ago) I would not be so concerned about delicate handling of the problem; I will look into setTempDir() in order to give the files a larger area to reside.


Are you sure that these files were generated by OLE/SEW? Do they start with "OLE_" or "php"?

The temporary files from these packages are only needed for the currently created XLS file. There is no usage later for these files.
Back to top
View user's profile Send private message
Kevin Barsotti



Joined: 11 Aug 2008
Posts: 4

PostPosted: Wed Aug 13, 2008 9:39 pm    Post subject: Reply with quote

mark wrote:
Kevin Barsotti wrote:
If there were not evidence in access logs on the server file system to indicate that the files are seeing recent use (ones created weeks ago were last accessed hours or days ago) I would not be so concerned about delicate handling of the problem; I will look into setTempDir() in order to give the files a larger area to reside.


Are you sure that these files were generated by OLE/SEW? Do they start with "OLE_" or "php"?

The temporary files from these packages are only needed for the currently created XLS file. There is no usage later for these files.


The do indeed begin with 'OLE_'. The issue arose again (full /tmp directory) and I have opted to do a drastic but reversible moving of all OLE_* files to a secondary partition for the time being. I added the necessary code to write to this directory by default, but I've yet to push that change live. However, if no bugs crop up as a result of my moving of the files, then that change may well be unnecessary.

Should the module be cleaning up these temp files on its own, or can I otherwise configure the software to take care of that? If it turns out they're in no way necessary for the application to perform its tasks, I can always opt to create a scheduled shell script to clean the files out of /tmp, but I'd rather do it in-software rather than on the OS level.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1004

PostPosted: Wed Aug 13, 2008 10:15 pm    Post subject: Reply with quote

Kevin Barsotti wrote:
Should the module be cleaning up these temp files on its own, or can I otherwise configure the software to take care of that?


OLE removes the files itself, using unlink() calls that are silenced with the "@" character. You could remove these characters from the calls to possibly get error messages from PHP (e.g. that the files cannot be deleted).
Back to top
View user's profile Send private message
Kevin Barsotti



Joined: 11 Aug 2008
Posts: 4

PostPosted: Wed Aug 13, 2008 10:29 pm    Post subject: Reply with quote

mark wrote:
Kevin Barsotti wrote:
Should the module be cleaning up these temp files on its own, or can I otherwise configure the software to take care of that?


OLE removes the files itself, using unlink() calls that are silenced with the "@" character. You could remove these characters from the calls to possibly get error messages from PHP (e.g. that the files cannot be deleted).


Ah, so if PHP's user permissions are not properly set for /tmp, it could theoretically be creating the files but not have the permissions to clean up after itself?
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1004

PostPosted: Wed Aug 13, 2008 10:45 pm    Post subject: Reply with quote

Kevin Barsotti wrote:
Ah, so if PHP's user permissions are not properly set for /tmp, it could theoretically be creating the files but not have the permissions to clean up after itself?


I'm not sure about the permissions, but yes, it seems that the files just cannot be deleted.
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