By fuser on
During the drupal installation process, we are required to make directory file - easier said then done.
What privilges do you make the directory with? I see people on this forum saying a 775, but only a 777 works for me.
Also as soon as I make a files/ directory and give it 777 drupal tries to make the files/tmp/ dir with user apache:apache and privileges 775.
This doesn't work and I have to chmod -R everything to 777 and the owner has to be the ftp hosting account user not apache:apache.
Any ideas on this?
Thank you
Comments
In most share hosting
In most share hosting servers 777 is required for directories writable by Drupal.
- The first digit is the file owners (your) permissions.
- The second digit are the permissions of users belonging to your "group".
- The third digit is everyone else's permissions
Drupal (and all php scripts) accesses files as user "apache" or user "nobody", not as you.
For directories created (owned) by yourself (e.g. with FTP), 775 would work only if user "apache" was set up as a member of your group, which is not the most common in shared hosting servers (so, 775 is practically equivalent to 755).
For files created (owned) by user "apache" (e.g. by Drupal), 755 is enough for Drupal writing, but that might cause you some discomfort when you try to move or delete files which you don't own -- you may even be unable to change permissions with FTP, depending on the server's setup. The security benefit is not big because files owned by apache are also fully accessible to other users of apache and scripts.
What I do is create files/tmp myself (with 777) before Drupal does, so that I own it.
Yes
To begin with thank you for your reply. I was starting to lose hope in drupal support.
"What I do is create files/tmp myself (with 777) before Drupal does, so that I own it."
That is what I did I created the directories before drupal did and everything worked fine until I change the color scheme for the default theme installed. I got a list of warnings saying that drupal could not create /files/color directory and add contents to it.
So I created that manually and gave it 777 and tried all different owners and it still did not work and gave he same errors.
Any thoughts on this one?
First, I assume that the
First, I assume that the error message means a "files/color" directory without a front slash. (That is that your general file setting is "files" and not "/files").
- Color module tries to create a "files/color" subdirectory, so the "files" directory itself must be 777.
- The new "color" directory will be 775 (I think) and owned by apache (except if you create it yourself before with 777 so that you own it). In either case it will work.
- Under the "files/color" directory, the color module will be creating more subdirectories for color schemes. These ones you can't create beforehand because their names will be random numbers, but they will be owned by apache and 775, so no problem.
Yes all assumptions are
Yes all assumptions are correct, but it doesn't work as you said.
files/ is my general file setting directory
I created files/ and files/tmp/ and files/color/ as drupal was having problems doing that and all of them have 777.
I tried setting apache:apache as the owner but that didn't work too. So the owner is the ftp account (or hosting user account).
Still doesn't work
What was the exact error
What was the exact error message? Anything about "php safe mode restrictions"?
This is when confirguring the garland theme
If we change the color set from the default to anything else, here is what I get and nothing changes:
warning: copy() [function.copy]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: copy(files/color/garland-a89a34a7/menu-collapsed.gif) [function.copy]: failed to open stream: Success in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: copy() [function.copy]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: copy(files/color/garland-a89a34a7/menu-expanded.gif) [function.copy]: failed to open stream: Success in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: copy() [function.copy]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: copy(files/color/garland-a89a34a7/menu-leaf.gif) [function.copy]: failed to open stream: Success in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 252.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: imagepng() [function.imagepng]: Invalid filename in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 401.
warning: fopen() [function.fopen]: SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /var/www/vhosts/mydomain.com/httpdocs/files/color/garland-a89a34a7 owned by uid 48 in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 338.
warning: fopen(files/color/garland-a89a34a7/style.css) [function.fopen]: failed to open stream: Success in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 338.
warning: fwrite(): supplied argument is not a valid stream resource in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 339.
warning: fclose(): supplied argument is not a valid stream resource in /var/www/vhosts/mydomain.com/httpdocs/modules/color/color.module on line 340.
As I suspected... not much
As I suspected... not much hope. Your host is using the overprotective "safe mode" of PHP5 (which is going to be removed from PHP6). This is rare with proper hosts but very usual with ISPs who offer hosting as an additional service.
In short,
- the color module creates directories with random names such as files/color/garland-a89a34a7 which are owned by user apache
- although the script writes as user apache, "safe mode" makes additional demands about the user who runs the script (you) and it does not allow the script to write in a directory owned by apache.
This problem would not exist if the directory had been created by you and was set to 777, but apparently this is not possible because of the random names.
If you must use the color module's color schemes, a workaround is to do it on another server (e.g. locally on your computer using XAMPP) and then take all the content of that directory and copy it to a subdirectory of garland with an appropriate name (e.g. themes/garland/brown_garland).
Cannot copy/upload image files
Thank you, CogRusty, for your comment above. It seems the best explanation as to why I cannot upload images. Have spent the better part of 3 days trying everything anyone has suggested.
The temporary image file (example tmp_Wn3Zeu) is created by Apache without the necessary access privileges, despite everything I have done.
I receive the following error messages:
"The selected file /var/www/vhosts/my_domain.com/httpdocs/files/tmp/tmp_Wn3Zeu could not be copied."
"The selected file /var/www/vhosts/my_domain.com/httpdocs/files could not be copied."
I am running a multi-site setup on a dedicated server:
Drupal 5.1
Configuration file Protected
File system Writable (public download method)
GD library bundled (2.0.28 compatible)
MySQL database 4.1.20
PHP 5.0.4
Unicode library PHP Mbstring Extension
Web server Apache/2.0.54 (Fedora)
Is it likely my ISP will change from the "safe mode" that may be responsible? Other ideas?