400 Error on TimThumb - wordpress

I'm testing a WordPress plugin that uses TimThumb.
On one server (GoDaddy) I'm getting a 400 (Bad Request) error whenever I request the timthumb.php file from the plugins directory. However, an identical request on a different server works just fine.
/wp-content/plugins/wp-vimeo/timthumb.php
I'm puzzled. I can request other files in the same directory just fine. Could it be a permissions issue? I would have expected a 403 if that were the case.

For Windows hosting add IUSR (or whatever account your app pool is running) to wp-content with read/write.

For me it was because my images were to be resized.
If you copy paste the timthumb url int the browser and receive the error that the image size is to big. I had to either change the file size of the images or change the timthumb's setting to handle bigger images.
This line in the timthumb.php file:
define ('MAX_FILE_SIZE', 3000000); // file size limit to prevent possible DOS attacks (roughly 3 megabytes)

I fixed it by moving my site from a Window Server to a Linux Server. Still on godaddy. [a]

Inside timthumb.php you'll find this line:
header ($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
This is triggered whenever there's an error: inaccessible cache, required query string variables missing, etc. I have found that link checkers like Google Webmaster Tools and Integrity sometimes remove the query string and check the validity of the root files. Of course without the query string timthumb.php will then return the 400 error.
To tidy this up I comment out the above line.

These answers don't seem to address the issue directly. You can paste the URL in of the timthumb call. In your browser you should get diagnostic error form timthumb. Usually it is because there is not a writable cache directory for timthumb to use to make the Image it serves.

Related

Is there a reason certain PDF's give me an error in WordPress when I try uploading them? [duplicate]

Does anyone know what this error message on WordPress means?
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
I couldn't find any errors that I can think of.
This happened when I tried to upload an MP4 file that is about 200MB in size. I have set my WordPress to accept MP4 of up to 5GB so that shouldn't be a problem, I am using WordPress Multisite installation on Ubuntu 16.04.
In my php.ini I have set the max upload size to 50GB and max post size to 50GB too and I also set the max memory to 1GB. But it just kept sending me that error and I have no idea where to look. All it says was an unexpected response and I have no idea what response that might be.
I can upload MP4 with a size of 27MB with no problem, I know the default WordPress setting is 20MB so I'm pretty sure the size isn't the problem.
I have also check that the file wasn't corrupted, it was working fine on my computer as well as YouTube.
I tried restarting PHP (PHP-FPM) and Apache2 but it doesn't seem to be working.
Does anyone has an idea of what is going on? Thanks 🙌
I think my answer is too late. but I would like to post a solution for anyone still looking for a solution for this issue on WordPress running on Nginx.
You should add the following directive to set the maximum allowed size in HTTP(server/location) section.
client_max_body_size 10M;
I have understood why this WordPress error occurs "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.", atleast in my case :D
Issue:
If you can upload any other file except this specific one, then it is an issue with the file's size.
Solution:
In my case everything was correct - upload limits, post_max_size, memory_limit etc but if you are using NGINX, the possible issue is with client_max_body_size
Step 1: In your nginx.conf file, increase the value of "client_max_body_size" to 256M (or more as needed).
Step 2: Restart nginx.
Now you can reload the media library and try uploading the file again. To be on the safe side, rename your file before uploading.
The mentioned error is generic, it may refer to more than one possibility, so check this out:
Maybe you enabled Cloudflare with basic plan in your hosting, if so, Cloudflare limits the upload to 100 MB.
Maybe you mixed content on your website, with some pages refering to http and other pages refering to https. If so, please check the link: https://websitesetup.org/http-to-https-wordpress.
Maybe you installed security plugin.
Deactivating "All in one WP security" did the trick. You can re-enable it after the upload.
I had the same issue and tried all of the solutions above but had no luck. I ended up using this plugin and it worked automatically. No idea why bc I didn't increase the max upload size or anything. I noticed in their reviews someone else had the same issue. So hopefully it'll help someone else out there!
https://wordpress.org/support/plugin/tuxedo-big-file-uploads/reviews/
This appears to be an issue with the newer versions of WordPress themselves, rather than anything server side.
It appears to be a known issue to WordPress developers that is being investigated (eg: https://core.trac.wordpress.org/ticket/48778)
I faced the same error and finally it was fixed.
you may installed maximum upload plugins and its configuration is different than your host configuration, for example: if you set max upload from the plugin to 512M and your host configuration is 64, your browser will show your maximum upload as 512M not 64, but later after uploading the unexpected error will display.
the solution : remove the max upload plugin as it my conflict with configuration.
and if you host your website with shared server service, call the support to update the max upload size for you
I had the same problem a number of times and again today. My client was trying to upload PDF's to the media library that were not large and he was getting the error message "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" The files were mostly around 1.6mb. Some worked, some didn't. They would upload but the preview of the file would not show in the media library. I tried using the Browser upload method also. Same result only once the upload completed we would get a 404 page not found error.
Ultimately I figured out the issue was an unsupported font used in the PDF files called ZeitungPro-Regular. When I opened the file in Adobe Acrobat DC Adobe showed the error message "Unrecognized font". I switched over to edit mode and changed the font to Arial Narrow as a test. Saved it and uploaded it and it worked! The issue was not with the server or the site set up, the issue was that WordPress could not process that font after uploading the file. If you are getting the "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" check the file you are uploading carefully.
For people using the Wordfence security plugin, I had the same issue combined to other listed here. Max upload size, nginx client_max_body_size, it finally worked but only for admins.
Then I had to switch the Wordfence firewall in learning mode and let users upload their large file, and turn the firewall back to production mode. Long calls to admin ajax were blocked.
Hope this helps.
I came looking for a solution to this same problem. What caused the problem was an apostrophe in the file name. Simply removing that allowed the same file to upload without an issue.
I also faced the same error. I just deactivated the wordfence security plugin and now it's work fine. Hope help someone.
I had the same problem on Windows when I upgraded PHP to a newer version.
The problem was that the /logs and /tmp folders did not exist in the new PHP folder as it was set to c:\php\logs and c:\php\tmp in the php.ini file.

Wordpress uploading .docx file via Media Library Unexpected response from the server [duplicate]

Does anyone know what this error message on WordPress means?
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
I couldn't find any errors that I can think of.
This happened when I tried to upload an MP4 file that is about 200MB in size. I have set my WordPress to accept MP4 of up to 5GB so that shouldn't be a problem, I am using WordPress Multisite installation on Ubuntu 16.04.
In my php.ini I have set the max upload size to 50GB and max post size to 50GB too and I also set the max memory to 1GB. But it just kept sending me that error and I have no idea where to look. All it says was an unexpected response and I have no idea what response that might be.
I can upload MP4 with a size of 27MB with no problem, I know the default WordPress setting is 20MB so I'm pretty sure the size isn't the problem.
I have also check that the file wasn't corrupted, it was working fine on my computer as well as YouTube.
I tried restarting PHP (PHP-FPM) and Apache2 but it doesn't seem to be working.
Does anyone has an idea of what is going on? Thanks 🙌
I think my answer is too late. but I would like to post a solution for anyone still looking for a solution for this issue on WordPress running on Nginx.
You should add the following directive to set the maximum allowed size in HTTP(server/location) section.
client_max_body_size 10M;
I have understood why this WordPress error occurs "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.", atleast in my case :D
Issue:
If you can upload any other file except this specific one, then it is an issue with the file's size.
Solution:
In my case everything was correct - upload limits, post_max_size, memory_limit etc but if you are using NGINX, the possible issue is with client_max_body_size
Step 1: In your nginx.conf file, increase the value of "client_max_body_size" to 256M (or more as needed).
Step 2: Restart nginx.
Now you can reload the media library and try uploading the file again. To be on the safe side, rename your file before uploading.
The mentioned error is generic, it may refer to more than one possibility, so check this out:
Maybe you enabled Cloudflare with basic plan in your hosting, if so, Cloudflare limits the upload to 100 MB.
Maybe you mixed content on your website, with some pages refering to http and other pages refering to https. If so, please check the link: https://websitesetup.org/http-to-https-wordpress.
Maybe you installed security plugin.
Deactivating "All in one WP security" did the trick. You can re-enable it after the upload.
I had the same issue and tried all of the solutions above but had no luck. I ended up using this plugin and it worked automatically. No idea why bc I didn't increase the max upload size or anything. I noticed in their reviews someone else had the same issue. So hopefully it'll help someone else out there!
https://wordpress.org/support/plugin/tuxedo-big-file-uploads/reviews/
This appears to be an issue with the newer versions of WordPress themselves, rather than anything server side.
It appears to be a known issue to WordPress developers that is being investigated (eg: https://core.trac.wordpress.org/ticket/48778)
I faced the same error and finally it was fixed.
you may installed maximum upload plugins and its configuration is different than your host configuration, for example: if you set max upload from the plugin to 512M and your host configuration is 64, your browser will show your maximum upload as 512M not 64, but later after uploading the unexpected error will display.
the solution : remove the max upload plugin as it my conflict with configuration.
and if you host your website with shared server service, call the support to update the max upload size for you
I had the same problem a number of times and again today. My client was trying to upload PDF's to the media library that were not large and he was getting the error message "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" The files were mostly around 1.6mb. Some worked, some didn't. They would upload but the preview of the file would not show in the media library. I tried using the Browser upload method also. Same result only once the upload completed we would get a 404 page not found error.
Ultimately I figured out the issue was an unsupported font used in the PDF files called ZeitungPro-Regular. When I opened the file in Adobe Acrobat DC Adobe showed the error message "Unrecognized font". I switched over to edit mode and changed the font to Arial Narrow as a test. Saved it and uploaded it and it worked! The issue was not with the server or the site set up, the issue was that WordPress could not process that font after uploading the file. If you are getting the "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" check the file you are uploading carefully.
For people using the Wordfence security plugin, I had the same issue combined to other listed here. Max upload size, nginx client_max_body_size, it finally worked but only for admins.
Then I had to switch the Wordfence firewall in learning mode and let users upload their large file, and turn the firewall back to production mode. Long calls to admin ajax were blocked.
Hope this helps.
I came looking for a solution to this same problem. What caused the problem was an apostrophe in the file name. Simply removing that allowed the same file to upload without an issue.
I also faced the same error. I just deactivated the wordfence security plugin and now it's work fine. Hope help someone.
I had the same problem on Windows when I upgraded PHP to a newer version.
The problem was that the /logs and /tmp folders did not exist in the new PHP folder as it was set to c:\php\logs and c:\php\tmp in the php.ini file.

403 Forbidden when requesting image from server

I have a static resource image on my static server (http://static.coderichard.com/) which I want to use for a Journal Skin which I'm designing on DeviantArt. But when the image is loaded, I got a 403 Forbidden error.
The image is loaded through CSS like so:
background-image: url('http://static.coderichard.com/img/intrvi-journal-skin-bg.png');
When I tried the exact same thing in JSFiddle, it worked fine. I can also load the image through the browser.
Checking error logs yielded no information and the directory the image is in has 755 permission.
Why am I getting this error and how can I fix it?
I read the following thread, having the same issue as me: http://ubuntuforums.org/showthread.php?t=2167595
The solution was to disable the hotlink protection via .htaccess, but I don't have a .htaccess file there so it makes no sense to try that.
My server is CloudFlare protected and uses Hotlink protection. What I did to fix it was add a directory called hotlink-ok and I put all my resources there which were okay to hotlink.
Try setting a referer with a commannd-line client. If it immediately 403s again, find where your "hotlink protection" is implemented.

Wordpress - wp-admin showing blank

Every part of my web site is working fine after I moved it from one hosting to another. The problem I have now is that I can't access wp-admin.
I now get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/everd1/public_html/precision/wp-content/themes/Avada/Avada/admin/functions/functions.options.php:1) in /home/everd1/public_html/precision/wp-includes/pluggable.php on line 1121
So far I've tried:
Removing trailing white space before and after functions.php and pluggable.php
Increasing the allowed memory size on the .htaccess file
Creating a php.ini within the wp-admin folder with the following memory_limit = 64M ;
Renamed the plugins folder to plugins-removed
Still no joy, anything I can do to fix this?
The warning that you have posted shows the exact error and the place that it is happening.
It looks like something within the Avada theme has broken when you were transfering it and it has since messed up the headers being sent through.
Only 1 set of headers can be sent to the client otherwise it cannot be handled and therefore throws an error.
I would recommend going to the theme creators (click here) and putting in a support ticket. One of their support team should be able to fix the problem that you are having.
You can check if some file of your Wordpress copy contains UTF-8 with BOM files and convert it to UTF-8 without BOM.
You can try this php script to make it faster : https://github.com/emrahgunduz/BomCleaner
Be sure to make a backup before running it.

Wordpress: "HTTP Error." When Uploading Files

I'm running WP 3.0.1 on a shared host using PHP5. I'm having issues uploading files that are a little larger via the media uploader in the admin section of WP.
Every time I try to upload a file thats over a few megabytes, it uploads, says its crunching, then gives me a big red "HTTP Error." - nothing more.
This only happens on files that are a little larger - ie a 20mb .mp3 file. A 5mb file seems to work fine. Whats weird is in the past we've uploaded 40mb files without a problem.
--
Here's the steps I've taken so far to try and remedy the situation:
Double checked php.ini to ensure increase upload, post and memory size were high enough.
Updated .htaccess to include filter the security mod I found elsewhere.
Double checked all file permissions via ftp to ensure they were 755.
Called the host - "They don't support 3rd party scripts" (I hate IPower)
Tried with different audio files of similar size.
Disabled all plugins
--
Do you guys have any more ideas regarding what might be causing the vague "HTTP Error." problem?
Thanks in advance.
I had a similar problem with Nginx and PHP5-FPM (and WordPress 4.1).
Symptoms: the file (< 5MB, so relatively small) is partway through the transfer, as indicated by the progress bar, when suddenly you get the HTTP error message.
Even if you've set upload_max_filesize in your php.ini, you should also check post_max_size is (at least) as big. Remember to restart php5-fpm.
If it still doesn't work, edit your nginx.conf file (in Debian/Ubuntu it's /etc/nginx/nginx.conf) and add this in the http block:
client_max_body_size 100m;
Then restart Nginx.
One of our clients, had the same issue.
Finally we found out that the wordpress "HTTP Error" when uploading images, was happening due to a change on the server side. The hosting comany, decided to add APC accelerate to the server in order to increase server's stability and speed. APC accelerate should work only with FastCGI and not with su, so they set PHP to run as FastCGI.
When using PHP as FastCGI, if you try to upload a file larger than 128KB, an error "mod_fcgid: HTTP request length 131388 (so far) exceeds MaxRequestLen (131072)" occurs and causes an 550 internal server error.
This happens because the value of MaxRequestLen directive is set to 131072 bytes (128KB) by default.
One way to correct this (if server uses Plesk), is to edit /etc/httpd/conf.d/fcgid.conf and set MaxRequestLen to a higher value, for example 15MB (MaxRequestLen 15728640).
If server uses cPanel, this change can be done via the WHM of the server.
So, if you can upload images up to 128KB, this is the solution to your problem.
Put this line in your wp-config file:
define('WP_MEMORY_LIMIT', '64M');
The problem, as you've already inferred, is in the size of your file upload. Just to remind you, HTTP isn't really built for transferring large files ... it can do it, but not always, and not very well. You're running into an issue where your host is cutting off the transfer because the file is too large. It's most likely a server setting somewhere that you don't have access to.
Since "they don't support 3rd party scripts" I'm guessing you're in a shared hosting environment, which is why something could change on your server without you doing anything. Possible solutions:
Get a different host
Use a dedicated server
Transfer your larger files via FTP rather than from within WordPress.
I had the same issue whenever I tried to upload media, except I got the "HTTP Error" on files larger than 124Kb! WP 3.3.1, PHP 5.2.
I called my host and they upped memory to 64M (also changed this in wp-config) and upload_limit to 8 MB (default was 2 MB). This didn't work so I resorted to almost everything else, from tampering with the .htaccess to reinstalling WP to installing a fresh WP on another server, but everything pointed to a server issue. I called the host again and spoke to another technician who increased the allowed HTTP Request Length setting.
For future readers, just managed to find the solution to this one after a tough day of searching.
There's a setting in the fcgid.conf file (for me in /etc/apache2/mods-enabled): FcgidMaxRequestLen. See https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidmaxrequestlen
I set that in bytes to an appropriate length and everything works. It seems that apache have changed their thinking on the default value (which is now 131072 bytes):
Before 2.3.6, this defaulted to 1GB. Most users of earlier versions should use this directive to set a more reasonable limit.
server maybe have imagick installed as default library , for a fix for wordpress
I put the following code into my functions.php file. It works!
add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
For me, "http error" issue occurred when php is running in fast cgi mode.
"MaxRequestLen" from mod_fcgid was limiting file upload size and wordpress was throwing "http error".
You need to add the following configurations in your httpd.conf (apache2.conf on ubuntu 14) :
<IfModule mod_fcgid.c>
# 20MB
MaxRequestLen 20000000
</IfModule>
I tried all the commonly suggested php.ini changes as well as wp-config changes with no luck. Finally found someone suggesting to look at the XHR async-upload.php details in my browser and found out that our firewall was flagging the upload as a trojan (MalAgent.H_9218 to be specific) for some reason. So don't forget to check there, it could identify other possible upload issues as well.
Chrome instructions:
Hit F12 and select the network tab, then attempt an upload with WordPress, make sure the filter row is on either All or XHR, in the left bottom pane find and select async-upload.php, in the right bottom pane select preview.
In my case solved by switching off Adblocker extention in browser
Our problem was that our load balancer ran out of hard disk space. Be sure to setup a log rotation that deletes the oldest logs after a period.
Our problem actually was client side: people tried to upload via drag and drop from OneDrive, files that have not been locally synchronised but showed up in the OneDrive folder. Resulted in "-200" error message. If file is on local harddrive, it worked fine.

Resources