I have this weird problem related to permissions on a VPS where I run 2 Drupal 7 websites.
I have an old site, which was migrated over several hosting providers and VPS setups. I also have a freshly installed website.
The new one works perfectly and I can set it to aggregate and compress CSS files plus JavaScript files. All is smooth and without errors.
The old one... each time I set it to do this, It gives me errors such as:
The specified file temporary://filepIYgt4 could not be copied to public://js/js_IaQHoIpFqzgiVl19GZEd2HEQg6iqLy6d1_xllBmEbqE.js.
The specified file temporary://fileTbJH3r could not be copied to public://css /css_Lnc8IK4qbp4ueX76wBYIBGAqVihLWtCHHNP7WBSphEM.css.
Both websites are configured the same way. The difference though seems to be in the permissions set for the sites/default/files folder. The new website (which works fine) has the permissions set to 0777 and the group and owner are set to apache.
The old website (which generates errors) has the permissions set to 0777, the group to psacln and the owner is the user I'm using to login to the website via SSH or FTP.
If I change the owner and the group to apache for the old website, things still don't work. I get warnings like these:
Warning: realpath(): SAFE MODE Restriction in effect. The script whose uid is 10002 is not allowed to access /var/www/vhosts/.../httpdocs/sites/default/files/css owned by uid 48 in DrupalLocalStreamWrapper->getLocalPath()
Warning: realpath(): SAFE MODE Restriction in effect. The script whose uid is 10002 is not allowed to access /var/www/vhosts/.../httpdocs/sites/default/files/js owned by uid 48 in DrupalLocalStreamWrapper->getLocalPath()
Warning: realpath(): SAFE MODE Restriction in effect. The script whose uid is 10002 is not allowed to access /var/www/vhosts/.../httpdocs/sites/default/files/ctools owned by uid 48 in DrupalLocalStreamWrapper->getLocalPath()
As you can see, Drupal still can't write to the same troublesome folder. :(
What am I doing wrong? Any advice how to fix this?
chmod 777 -R sites/all/files
? Also if possible try to clear your cache...