TimThumb 上的 400 错误
我正在测试一个使用 TimThumb 的 WordPress 插件。
在一台服务器 (GoDaddy) 上,每当我从插件目录请求 timthumb.php 文件时,都会收到 400(错误请求)错误。但是,不同服务器上的相同请求可以正常工作。
/wp-content/plugins/wp-vimeo/timthumb.php
我很困惑。我可以请求同一目录中的其他文件就好。会不会是权限问题?如果是这样的话,我会期待 403。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对于 Windows 托管,将 IUSR(或您的应用程序池正在运行的任何帐户)添加到具有读/写功能的 wp-content 中。
For Windows hosting add IUSR (or whatever account your app pool is running) to wp-content with read/write.
对我来说,这是因为我的图像要调整大小。
如果您将 timthumb url 复制粘贴到浏览器中并收到图像尺寸太大的错误。我必须更改图像的文件大小或更改 timthumb 的设置才能处理更大的图像。
timthumb.php 文件中的这一行:
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:
我通过将站点从
Window Server
移动到Linux Server
来修复此问题。还在干爹。 [一个]I fixed it by moving my site from a
Window Server
to aLinux Server
. Still on godaddy. [a]在 timthumb.php 中,您会找到这一行:
header ($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
每当出现错误时就会触发此行:无法访问缓存,需要查询字符串变量我发现像 Google Webmaster Tools 和 Integrity 这样的链接检查器有时会删除查询字符串并检查根文件的有效性。当然,如果没有查询字符串,timthumb.php 将返回 400 错误。
为了整理这个问题,我注释掉了上面的行。
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.
这些答案似乎并没有直接解决问题。您可以将 URL 粘贴到 timthumb 调用中。在您的浏览器中,您应该会收到 timthumb 的诊断错误。通常是因为没有可写的缓存目录供 timthumb 用来制作它所服务的 Image。
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.