Jump to content

hadenp

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hadenp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. According to the tech support people, the reason larger uploads (> 2MB) would fail was due to either a timeout on how long the script was allowed to run or as pointed out, a memory limitation. So would moving to a VPS very likely fix this type of error? The reason I ask this is because, if I understand correctly, with a VPS one still shares the cpu and memory w/ an unknown # of other applications and therefore my app is contending for resources. My guess is that even with "busy" neighbors my uploads that were in effect being yanked would still proceed, but just take longer... correct? Thanks for responding!
  2. Today I got GoDaddy tech support to replicate the error. Their explanation was that the script stops (or is terminated?) due to a setting in the shared hosting environment and that moving to a virtual dedicated server 'might' correct it. Not sure if that makes sense since it seems that this is a resource issue - but I don't know much about shared hosting vs VPS. At that point (I'd been on the phone with them for over an hour) I didn't remember this article - http://help.godaddy.com/article/1475? which to me contradicts what I was told. Oh well, guess I'll call them back. BTW, I did try bumping up the memory and get_memory_usage function(true) ...but without success.
  3. Thanks for your reply. I see the 'Internal Server Error' on the screen and the 'Premature end of script headers:' + path/program_name in the errors log. I use GoDaddy's 'Error Log' interface to view the errors. Something more specific would likely help shed light on what's causing the error - but it isn't there. For time limits, I've set these in php5.ini: max_input_time = 360 max_execution_time = 360 When there's an error, it returns in ~1 minute, so I don't think time is the issue. I'm thinking it must be a permissions issue - but why it only appears with larger files (and only on GoDaddy) is for me, the paradox. On the GoDaddy site, PHP is run as a cgi but on the server where I tested successfully it runs as an apache module. I don't think that should matter, but I don't know...
  4. Yes, I've been using phpinfo.php to verify these values ...but I checked them again. All the values are as listed in my original post - except for 'upload_files = on' - (didn't list that in op) and 'post_max_size = 10M').
  5. I contacted my hosting provider (GoDaddy) and to my surprise their upload limit is 8MB! (overridable) - the same as my limit - so file size can't be the issue. Even though I'd never had a problem uploading small files, I tried my script on a different server and uploaded a 6MB file. (I got a permissions error at first - so I chmoded the upload directory to allow write access - 777.) After chmoding the target directory on the GoDaddy site, I tried again but still no success uploading files over 1 MB. So this is a real conundrum. (The set_time_limit(0) didn't help - but thanks for the suggestion.) Is there some other permissions issue I'm not aware of? How do I find out the permissions my PHP program has? Is there a way to get a more specific error message than the 'Internal Server Error' & 'Premature end of script headers' - supplied by Apache I believe. Thanks in advance for you suggestions.
  6. When I upload files > 2MB, I get an "Internal Server Error" and in the errors log see "Premature end of script headers:..." No problem with smaller files. I'm running PHP 5.28 and have the following in php5.ini. magic_quotes_gpc = Off log_errors = on display_errors = off memory_limit = 64M post_max_size = 8M upload_max_filesize = 8M max_input_time = 360 max_execution_time = 360 upload_tmp_dir = amd_temp The permissions for the upload folder are set to 755. Here's the code: <?php if ($_SERVER['REQUEST_METHOD'] == 'GET') { ?> <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>" enctype="multipart/form-data"> <input type="file" name="document"/> <input type="submit" value="Send File"/> </form> <?php } else { if (isset($_FILES['document']) && ($_FILES['document']['error'] == UPLOAD_ERR_OK)) { $newPath = 'updocs/' . basename($_FILES['document']['name']); if (move_uploaded_file($_FILES['document']['tmp_name'], $newPath)) { print "File saved in $newPath"; } else { print "Couldn't move file to $newPath"; } } else { print "No valid file uploaded."; } } ?> Any thoughts on what might be the problem? Thanks.
  7. Have you managed to resolve this? I've been experiencing the same problem with uploads on Godaddy. More specifically uploads > 1MB will fail with the error you cite - 'Premature end of script headers' - but smaller ones go through fine. I've also set the relevant upload values in my php5.ini. My code works fine in my (MAMP) development environment, so I'm wondering how I can debug it. Thanks.
  8. Is there a way to get the source path for an uploaded file? It seems that's a function of the browser and the two I've tried FF and Safari don't return it in $_FILES['file']['name'].
  9. I'm getting a '500 Internal Server' and 'Premature end of script headers..' errors in the process of uploading a file. This occurs consistently with files > 2MB but also (very occasionally) w/ smaller files. The target directories are beneath the web root folder, so I don't think it's a permissions issue. I've set the following in my php5.ini: post_max_size = 8M, upload_max_filesize = 8M max_input_time = 360 max_execution_time = 360 Trace code/logging reveals that the error occurs even before my upload code is entered (which uses (move_uploaded_file()). So what would cause that? Any suggestions on how to debug this are very much appreciated!
  10. Thank you! Wish I'd checked back earlier. In the interim I used exec() w/ ls to get the results I needed - a bit of a hack but it works. Question about: foreach ($iterator as $dirIt => $fileObj) I didn't know how to reference the returned iterator like this. How/where does one find out usage examples? Googling? I didn't see such examples when I looked up RecursiveDirectoryIterator, RecursiveIteratorIterator in the PHP:SPL - Manual. Thanks again. BTW, Great avatar!
  11. I believe SPLMaxHeap starts with 5.3. but I'm working in 5.2.x environments. Would you have a suggestion on how to sort these iterators in 5.2? - I'm fairly new to PHP. Thanks.
  12. >>If you wish to change the order then you have to sort the elements you're iterating over. That makes sense, but would you have some suggestions on how to do this? Given that I have an iterator object, do I need to cast it to an array and then sort the array(s). Moreover, are there simpler (non-recursive) ways to achieve a sorted list of directories/sub-directories? Thanks.
  13. In trying to list directories using RecursiveIteratorIterator, I get unsorted results under Linux - (OS X presents the results in ascending order). $startPath = 'documents/'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($startPath), RecursiveIteratorIterator::SELF_FIRST); sort($iterator); // Under Linux I get a warning that sort expects an array Any idea how can I perform a sort a RecursiveIteratorIterator object? TIA
×
×
  • 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.