Hello,
A few days ago I migrated my Drupal 7 website to a new virtual machine hosting service, provided by the same hosting company I used in the past. The new service is hosted on new and better machines, so I went for the "upgrade". Since then, 4 days have passed and all was well. Today, my website has huge caching issues and looks awful if caching is enabled. It works well only if I disable it which, in turn makes my VPS reach is hardware capacity limits.
If I look in the error logs, there are countless entries about js and css files. I receive errors such as:
The specified file temporary://fileYdRBje could not be copied to public://js/js_HoV11dGZPFawmXjkAgvlTs7lxi0Nyd-JEPDssHq-VCc.js.
or The specified file temporary://fileQS3T62 could not be copied to public://css/css_Lnc8IK4qbp4ueX76wBYIBGAqVihLWtCHHNP7WBSphEM.css.
They stop only if I stop caching.
I don't know what the problem is. I read many forum topics and issues reported by others. I double-checked things like:
- php.ini has set safe_mode Off;
- The public system path is set as sites/default/files;
- The temporary directory is set as tmp, without /. The permissions for it are set to 777;
- The permissions for the folders css and js, found in httpdocs/sites/default/files are set to 777
Still... the problem continues to persist. Any other ideas on what the fix could be?
Appreciate any help I can get.
Comments
One detail I just noticed.
One detail I just noticed. The trouble happens not when caching is enabled, but when:
Compress cached pages.
Aggregate and compress CSS files.
Aggregate JavaScript files.
are turned on. If they are turned off, everything works fine.
chmod the actual js/css files
I had a similar situation arise when I used "drush up" to upgrade from 7.9 to 7.10 yesterday on my local dev environment. So I did all the chmod 777 on the paths as you mentioned but nothing worked until I chmod-777'd the actual temporary css and js files, js_HoV11dGZPFawmXjkAgvlTs7lxi0Nyd-JEPDssHq-VCc.js and css_Lnc8IK4qbp4ueX76wBYIBGAqVihLWtCHHNP7WBSphEM.css in your case above.
I am not sure why the permissions changed on those files during the "up" but I assume that blockage has now been cleared for good as all works well 8 hrs later. Glad to be using GIT in a situation like this, learning to solve problems I didn't know I had everyday.
Unfortunately this error is
Unfortunately this error is not only for the two files I mentioned but for all js and css files being created in used by the website. And there are more than 100 of them. There must be a better way to handle this.
Any way I could use the htaccess file inside the tmp folder? If yes... how?
Anyone... any ideas?
Anyone... any ideas?
Permissions
Most FTP programs will let you do something like this...
select a folder
right click
choose permissions
change to 777
before hitting ok/submit/whatever, click a checkbox that says something about setting the permissions recursively
By selecting the recursive option, all items inside that folder will also be set to 777
I have to do this whenever I move a site from production to live or when I use my base site to create a new site. It's real quick if you use the recursive option.