views:

390

answers:

4

I'm on a VPS environment so I have root access, btw.

So take a look at these issues: http://www.sonikastudios.com/wp-content/themes/sonikas/scripts/timthumb.php?src=/wp-content/uploads/tedleescreenshot1.jpg&w=100&h=100&zc=1&q=100

That returns a 404 error.

However when I move timthumb.php to the root of the site, it works.

I verified file/folder permissions, it's not the issue. Also, another PHP generated image that i use for Captcha, is doing the same thing...

So essentially it boils down to no .php files running from within folders. However this is not an issue otherwise because PHP scripts I have under /admin/ on other sites work fine.

So... what could cause this? Most forum articles I read lean towards a mod_security problem, but I don't even know where to start, as I'm not an apache expert.

+1  A: 

As you have root access, try looking for what is happening in Apache logs. To follow latest request you can use tail.

Which version of Apache you are running? In my configuration of Apache 2.2 you can follow error log in terminal by invoking:

tail -f /var/log/httpd/error_log

It seems that default configuration of Apache 2.2 has error log in /usr/local/apache2/logs/error_log, so my configuration is not default.

If you do not have success with error log, try also looking for information in access log, default location at /usr/local/apache2/logs/access_log.

jsalonen
Can't find that httpd folder...any other location wher the error log might be?
jeffkee
My mistake! I found out my configuration was devised from default. I added some tips that could help you more!
jsalonen
[Thu Feb 04 01:44:00 2010] [error] [client 174.6.169.139] SoftException in Application.cpp:610: Directory "/home/sonikas/public_html/wp-content/themes/sonikas" is writeable by others, referer: http://www.sonikastudios.com/portfolio/drive-dance-centre[Thu Feb 04 01:44:00 2010] [error] [client 174.6.169.139] Premature end of script headers: timthumb.php, referer: http://www.sonikastudios.com/portfolio/drive-dance-centreI think that's the culprit. So I guess there's heightened security... I'm usually lazy and I just set permission to 777 but i suppose I shoudl go with 755 or something.
jeffkee
FIXED!!!!! I changed wp-content to permission 755 and it worked!!! Thakn you so much - you pointed me towards the perfect place to do this. You are great.
jeffkee
No problems mate :) This also gives you one more good reason why setting permissions to 777 is not a good idea ;)
jsalonen
http://www.jeffkee.com/web-development-design/timthumb-php-404-apache-php-security-chmod-755-777-error-lo/
jeffkee
+2  A: 

Wordpress is probably using some mod_rewrite rules to send every request to its index.php. And there it’s analyzing the request and returning a 404 status code if one of its internals was requested.

Gumbo
Not just that issue. Any other files (jpgs for example) run fine in the sub-folders and do not revert to the /index.php file. I understand what the mod rewrite in the .htcaccess does. These sites and files worked just fine on my previous server. I just migrated for faster speed and larger capacity etc., and some apache or php setting is preventing this from working.
jeffkee
+1  A: 

This is a problem with your .htaccess file generated by WordPress. It redirects all requests for your site that aren't wp-admin/ or in your uploads directory to the index.php file for WordPress (the request handler that queries for posts, etc.)

nickohrn
jeffkee
A: 

Same error can occur when the file it self is also writable. Make sure the file is 644 and NOT 666 !

DonPuia