Thursday, April 3, 2008

Error: No space left on device - PHP, IIS, Win2K3

Today I went to upload on one of my client's sites and realized that the uploads were not working.

After looking at the directories and permissions to ensure that they were not deleted, I went back to see that the directories that were suppposed to be created with each upload where not being created.

I went to turn error reporting on the php script:

error_reporting(7);

this error appeared on the IIS 6, Windows 2k3 Box.

Warning: mkdir() [function.mkdir]: No space left on device in E:\Domains\www.domainname.com\html\upload_new.php on line 75

I checked and there was enough space left on the device. I moved the upload to different drive and that seemed to work. But no matter what I did on the upload directory permissions wise, I was still receiving the same error.

After going crazy for a while, I found a post online that could be very helpful in debugging if my post does not solve your problem.

It ended up being that the IUSER_XXXXX ran out of space for their disk quota and was not being allowed to write to the disk. There are a few ways that you can fix this, but I don't need quota's turned on for this machine and I don't care if they go over the quota, so I chose to just turn the enforcement off. You could easily delete files to go back under quota or raise the users quota.

You can change your quota rules by going to your volume or drive (e: in my case) and right clicking and selecting properties. There you can see a quota tab. There are a few options here (which I will not get into), but to fix the problem you can easily just click a checkbox which will stop the system from enforcing quota rules (it will stop disabling people if they go over the quota). Likewise, you can change your quota limitations on this screen.

If you find this useful, please digg me, link me, or click on a sponser for which you find legitimate interest.

Labels: , , , , , , , , ,

Thursday, March 6, 2008

Flex Upload IO File Error

So we kept getting the infamous file io error when we were doing some very large uploads with our flex upload. We spent a lot of time debugging this and we kept thinking that it had to do with the HTTP Keep Alive on PHP level.

The symptoms are as follows:
User uploads file and it seems to go fine or get through most of the way.
Upon completion of upload (or not), the flex module hangs at 100% uploaded or returns a File IO Error (or similar).
The upload module will work through PHP in most cases, usually when the large files are uploaded, this is when you have issues.

This is what I did to debug the issue.
I went into the PHP tmp folder to actually watch the files as they uploaded. From here I was able to start discerning a pattern of what was happening. It seemed that the file was getting stuck at 5:00 minutes exactly. I was able to replicate the issue and I realized that the process which was handling the upload, must be getting stuck or timing out.

Since it is PHP that is handling the file upload, I went on see what was in phpinfo(). I noticed that the HTTP_Keep alive was exactly 300 seconds = 5 minutes.

This lead me (eventually to the right location), but it was not the http keep alive. I went through regedit in windows and actually searched all the registry kees for the term alive and also for a value of 300.

Nothing seemed to add up.
I eventually remembered that there were several settings in the IIS Metabase that are usually hidden (or rather deep). I went through and did a search for 300 (seconds). I found that the cgi timeout setting was set to exactly this.

I changed this setting to a much higher value, and what do you know... it solved the problem. The CGI timeout value will limit how long your upload will last, so be sure that it is adequate for the size of files that you will be expecting.

Labels: , , , , , , , , , , , , , , , , , ,