JustinStone Posted May 9, 2014 Share Posted May 9, 2014 Hey guys/girls. I've been having problems with MediaTemple GS web hosting lately. I have a content site that allows members to upload files(up to 99MB in size). But I have been having problems lately. My script stops dead on the 2 minute mark and throws either a 500 internal server error or I get the dreaded open_basedir error. Either way the upload script stops at the 2 minute mark. I have edited the php.ini file for a max_execution_time of 300(5 minutes right?). MediaTemple says that is the longest their GS will allow. But still I'm throwing an error at 2 minutes. Also, I've let my members know that the max file size is 99MB which stinks because I would like a limit of 200MB. MediaTemple again says that the GS will only allow a max of 99MB. My php.ini file looks like the following upload_max_filesize = 99M post_max_size = 100M memory_limit = 99M max_execution_time = 300 magic_quotes_gpc = Off output_buffering = 4096 allow_url_include = On allow_url_fopen = On session.save_path = /home/xxxxxx/data/tmp Am I really screwed with MediaTemple by not allowing me the larger uploads? The 99MB uploads MIGHT be ok, but I can't get the script to run any longer than 2 minutes. Is there anyone out there with MediaTemple web hosting and can you run an upload script longer than 2 minutes or upload more thatn 99MB's? Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/ Share on other sites More sharing options...
mac_gyver Posted May 9, 2014 Share Posted May 9, 2014 max_execution_time is the time limit of your .php script. your php script isn't invoked until after the file has been uploaded to the server and php (the language engine, not your .php script) has done things like check the various size limits, check for errors, and move the file to the temp upload file location. take a look at max_input_time - http://us2.php.net/manual/en/info.configuration.php#ini.max-input-time Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478828 Share on other sites More sharing options...
JustinStone Posted May 9, 2014 Author Share Posted May 9, 2014 (edited) max_input_time is set to -1 by default on MediaTemples Grid service. I don't think this is the problem. When the submit button is clicked, all of the POST data and file checking should be done pretty quickly I would think. I just find it strange that all errors happen exactly at the minute mark. With the 500 error, I've check the error logs and I see the mod_security error. MediaTemple refuses to help me with it by saying that they can not help with my php script. I really don't think it is the script, I believe it is something else. I know this was pretty vague, but I'm still learning this stuff, so hopefully someone out there has had similar problems as me and has gotten them fixed. Edited May 9, 2014 by JustinStone Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478829 Share on other sites More sharing options...
mac_gyver Posted May 9, 2014 Share Posted May 9, 2014 does a phpinfo(); statement show the expected/correct values for the relevant settings? Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478832 Share on other sites More sharing options...
JustinStone Posted May 9, 2014 Author Share Posted May 9, 2014 I'm not coming here looking for quick help, I've been trying to figure this out myself for a couple months actually(sad, yes). When I get the open_basedir error, it comes from the last line posted here. $tname2 = time(); $track_name=$tname2.'.'.$extension2; $new_track_name="tracks/".$track_name; $copied2 = copy($_FILES['track']['tmp_name'], $new_track_name); And when I get the internal 500 error, it is the mod_security error Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478833 Share on other sites More sharing options...
JustinStone Posted May 9, 2014 Author Share Posted May 9, 2014 (edited) MediaTemple has their defualt setting for the open_basedir set by default. They said(and it show an example on their site) of what to have for someones site if there is an error. I have done what it shows, but I still get the error. open_basedir = "/home/xxxxxx/data/tmp:/home/xxxxxx/domains/mysite/html" I change it to that, and the site works fine, but the upload will either throw the open_basedir error or the 500 error. (Will throw the errors even if I leave the default settings for open_basedir) I'm stumped. Been banging my head for months. Edited May 9, 2014 by JustinStone Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478834 Share on other sites More sharing options...
Clarkey Posted May 9, 2014 Share Posted May 9, 2014 It may not be PHP timing out. The web server that is actually serving the request (probably Apache or NGiNX) may have a 2 minute timeout set. Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478866 Share on other sites More sharing options...
JustinStone Posted May 9, 2014 Author Share Posted May 9, 2014 So how do I get around this? Move to a different hosting company? Is there anyone here or does anyone here know of any web hosting services that doesn't have such terrible settings? Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478924 Share on other sites More sharing options...
gizmola Posted May 9, 2014 Share Posted May 9, 2014 You really have to pinpoint what your problems are. Based on the information provided, it seems you are conflating several different problems. For example, open_basedir errors have nothing to do with file size. You have to isolate the specific problems you have and the specific error messages you receive given a set input. I did notice a couple of things in your code: First off: $copied2 = copy($_FILES['track']['tmp_name'], $new_track_name); You should read about and utilize http://www.php.net/manual/en/function.move-uploaded-file.php rather than copy. You also have this: $track_name=$tname2.'.'.$extension2; $new_track_name="tracks/".$track_name; You should never use a relative path for file oriented routines as you are here with 'tracks/...'; You should establish a variable with the full base path to the 'tracks' directory and have that assigned so that your move_uploaded file is working with the full path to the directory ie. '/path/to/tracks' . $track_name. As for the Media Temple restrictions, there are untold numbers of hosting options out there. If you can't live with MediaTemple's restrictions you can easily find plenty of other alternatives out there. It's all a question of price. Virtual hosting is often preferable to shared hosting when you have outgrown the limitations of the shared hosting environment, but shared hosting environments do tend to offer extremely low pricing. Of course the old saying tends to be true that "you get what you pay for". Shared Hosting is often a bait and switch, advertising unlimited resources while at the same time providing limits in the configuration, and at the same time, over subscribing the service. There is also a long history of weeding out customers that end up being heavy users of the resources. They make their money on pure volume and you pretty much are on your own when it comes to support, even when the support issues are ultimately caused by their configuration. Typically you can get a form of support and answers for a lot of your questions if you take them to the forums. For example MT has these: https://forum.mediatemple.net Rarely will you be the first person to encounter a limitation like the one you describe. Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478927 Share on other sites More sharing options...
JustinStone Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) To take it back to the basics, I'm just using a small upload script that is found everywhere online. Here is what is going on with my uploads. I'm getting an error now with mod_security when uploading a 96MB file. [Fri May 09 19:47:45 2014] [error] [client xxx.xx.xxx.xxx] ModSecurity: Input filter: Failed writing 1460 bytes to temporary file (rc 1431). [hostname "mySite.com"] [uri "/TestUpload.php"] [unique_id "xxxxxxxxxxxxxxxxxxxxxxx"] <?php $target_path = "rider_pics/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $message = $_FILES['uploadedfile']['error']; if(move_uploaded_file($_FILES['uploadedfile']['name'], $target_path)) { echo "<input value='http://mysite.com/rider_pics/". basename( $_FILES['uploadedfile']['name']). "' style='width: 100%'>"; } else{ echo 'There was an error uploading the file, please try again!' . $message; } ?> And when trying to upload a smaller 14MB file, I get the error of '0' from $message. Error '0' should mean that the file uploaded without any problems, but the file isn't on my server. Edited May 10, 2014 by JustinStone Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478958 Share on other sites More sharing options...
DavidAM Posted May 10, 2014 Share Posted May 10, 2014 The first example from the manual for move_uploaded_file $uploads_dir = '/uploads'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } } Look at line # 4. You need to use the key tmp_name not name as the source (the file to be moved). Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1478960 Share on other sites More sharing options...
JustinStone Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) Ok, so. This script works, partially. I have 6 different file sizes that I'm trying, 14MB, 26MB, 39MB, 52MB, 74MB and 92MB. The 14, 26, 39 and 52 seem to upload just fine. When I get to the 74MB, I get the ELSE statement from below (There was an error uploading the file, please try again!) I checked my error log on my server and this is shown ModSecurity: Input filter: Failed writing 1460 bytes to temporary file (rc 889). [hostname "mySite.com"] [uri "/myScript.php"] [unique_id "XXXXXXXXXXXXXXXX"] <?php target_path = "rider_pics/"; $target_path = $target_path . basename( $_FILES['track']['name']); $message = $_FILES['track']['error']; if(move_uploaded_file($_FILES['track']['tmp_name'], $target_path)) { echo echo "The file " . basename( $_FILES['track']['name']) . " has been uploaded"; } else { echo 'There was an error uploading the file, please try again!' . $message; } ?> Edited May 10, 2014 by JustinStone Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479022 Share on other sites More sharing options...
sKunKbad Posted May 10, 2014 Share Posted May 10, 2014 <?php if( isset( $_FILES['track'] ) ) { if( ! is_dir( __DIR__ . '/uploads' ) ) { mkdir( __DIR__ . '/uploads', 0777, TRUE ); } if ( ! @copy( $_FILES['track']['tmp_name'], __DIR__ . '/uploads/' . $_FILES['track']['name'] ) ) { if ( ! @move_uploaded_file( $_FILES['track']['tmp_name'], __DIR__ . '/uploads/' . $_FILES['track']['name'] ) ) { echo $_FILES['track']['error'] . '<br />'; } } echo 'Upload attempted <br />'; } else { echo 'No Track'; } Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479024 Share on other sites More sharing options...
JustinStone Posted May 11, 2014 Author Share Posted May 11, 2014 (edited) I don't see why I would have to set the folder's permissions to 777 when 755 works just fine on the smaller sized files. ModSecurity: Input filter: Failed writing 1460 bytes to temporary file (rc 1173). Same error anyways with a 74MB file. I need to disable this garbage. lol. Does anyone really know what this error means. Searching google for days and no one really seems to have a straight answer. Edited May 11, 2014 by JustinStone Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479029 Share on other sites More sharing options...
sKunKbad Posted May 11, 2014 Share Posted May 11, 2014 I don't see why I would have to set the folder's permissions to 777 when 755 works just fine on the smaller sized files. ModSecurity: Input filter: Failed writing 1460 bytes to temporary file (rc 1173). Same error anyways with a 74MB file. I need to disable this garbage. lol. Does anyone really know what this error means. Searching google for days and no one really seems to have a straight answer. I wasn't suggesting that you use the script for production purposes, only to test basic file uploading. So 777 or 755, makes no difference. Quick search on Google for "modsecurity input filter" gave me this: https://discussion.dreamhost.com/thread-138012.html See last response, which indicates something useful about mod security: It's likely the /tmp/ directory that modsec2 is using is set down around the 100MB mark. You'd need to alter the modsec2.conf file to point SecTmpDir and SecUploadDir somewhere else - such as the upload_tmp_dir location you used in your PHP settings above. Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479033 Share on other sites More sharing options...
JustinStone Posted May 11, 2014 Author Share Posted May 11, 2014 I would love to modify the modSecurity settings, but with MediaTemple's grid service for 20 bucks a month, they will not allow me to do that. They won't even do it for me because they say they can't on their shared server. I've spoke with inMotion hosting and they told me they have no file size limit on uploads and they also said that if I have issues with modSecurity they would make the changes for me. I think I may be leaving MediaTemple. For 20 bucks a month, I am way too limited for that price imo Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479037 Share on other sites More sharing options...
sKunKbad Posted May 11, 2014 Share Posted May 11, 2014 I would love to modify the modSecurity settings, but with MediaTemple's grid service for 20 bucks a month, they will not allow me to do that. They won't even do it for me because they say they can't on their shared server. I've spoke with inMotion hosting and they told me they have no file size limit on uploads and they also said that if I have issues with modSecurity they would make the changes for me. I think I may be leaving MediaTemple. For 20 bucks a month, I am way too limited for that price imo I've used inMotion before, and also complained to everyone about how I felt they were deceptive and trying to get me to upgrade my account for no reason. As soon as I told them I was leaving, then all the sudden there was no problem. I've been using MDD Hosting, www.mddhosting.com for about 4 years now. I have a semi-dedicated account, which costs about $22 a month. They've been very helpful when I needed server changes, and they have a better "smaller business" type of customer support that works well for me. I have a lot of reasons that I like them, but some highlights are the litespeed server, php 5.5.12, and if something goes bonkers with the server they are very up-front with what is going on. For instance, when they had a hardware issue they emailed everyone letting them know that they were working on it and maybe to expect certain things. If you go with inMotion, remember this story if they tell you your account is using a lot of resources and they are going to need you to pay more for a better account. Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479052 Share on other sites More sharing options...
sirhawkeye Posted May 11, 2014 Share Posted May 11, 2014 (edited) Hey guys/girls. I've been having problems with MediaTemple GS web hosting lately. I have a content site that allows members to upload files(up to 99MB in size). But I have been having problems lately. My script stops dead on the 2 minute mark and throws either a 500 internal server error or I get the dreaded open_basedir error. Either way the upload script stops at the 2 minute mark. I have edited the php.ini file for a max_execution_time of 300(5 minutes right?). MediaTemple says that is the longest their GS will allow. But still I'm throwing an error at 2 minutes. Also, I've let my members know that the max file size is 99MB which stinks because I would like a limit of 200MB. MediaTemple again says that the GS will only allow a max of 99MB. My php.ini file looks like the following upload_max_filesize = 99M post_max_size = 100M memory_limit = 99M max_execution_time = 300 magic_quotes_gpc = Off output_buffering = 4096 allow_url_include = On allow_url_fopen = On session.save_path = /home/xxxxxx/data/tmp Am I really screwed with MediaTemple by not allowing me the larger uploads? The 99MB uploads MIGHT be ok, but I can't get the script to run any longer than 2 minutes. Is there anyone out there with MediaTemple web hosting and can you run an upload script longer than 2 minutes or upload more thatn 99MB's? Maybe try a different service? I like Hostgator myself and haven't had any problems with them. Not sure on the file upload limits, but 99MB does seem pretty high... you'd almost have to go to a virtual server for that stuff almost (on most hosts). But Hostgator (or even Bluehost) has their options customizable from what I've seen, but then again, I'm not dealing with 99MB uploads. Usually ones 20MB or less myself. Your host may do this to curtail massive file uploading for file sharing-type sites (not to say that you're doing that, but I could see that as a concern for webhosts)., Edited May 11, 2014 by sirhawkeye Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479094 Share on other sites More sharing options...
JustinStone Posted May 12, 2014 Author Share Posted May 12, 2014 Thanks for the info everyone. Is there anyone else out there that uploads large files on a shared hosting server? Say, 200MB's. Quote Link to comment https://forums.phpfreaks.com/topic/288356-am-i-out-of-options-for-a-web-host/#findComment-1479139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.