The D11 user settings page requires that we specify the file location for user pictures to use in their profile. It states that this (must be?) 'Subdirectory in the directory sites/default/files/ where pictures will be stored.'

Hovever, and subdirectory of this that i set up and specified results in the error message

•The directory does not exist.
•The settings have not been saved because of the errors.

despite the fact that I have cleared the path from the root and opened permissions to read/write

This is even when I leave the box blank as a test

Am I doing something daft?

Comments

cog.rusty’s picture

The apache user account must be able to write in your "files" directory (sites/default/files). Give the files directory permissions 777.

If you have already created the pictures subdirectory yourself, either delete it and let Drupal create it, or give it permissions 777 too.

Then go back to the user settings and try again .

sarav.din33’s picture

How to give the 777 permission to a directory in window os...

Please guide me on this issue as soon as possible..

Thanks & Regards
Sarav..

raymacz’s picture

Changing the permissions worked for me thanks

rogerwebb’s picture

I have 2 sites - one in D5 where your solution works = thank you

and one D6-11 where it doesn't create new files although permissions on sites/all/files is set to 777

cog.rusty’s picture

Is "sites/all/files" what you have specified in the admin/settings/file-system page?
Or do you mean "sites/default/files"?

Does the admin/reports/status page complain about anything?

rogerwebb’s picture

It is indeed sites/default/files and the planned subdirectory is sites/default/files/pictures.

I have tried every combination in the box

1. pictures
2. /pictures and so on right up to
3. sites/default/files/pictures

With the file structure created by hand and without.

The module does not create a file as D5 does even though sites/default/files/
is read/write cleared all the way through.

The D6.11 avatar module has created a file sites/default/files/avatar_selection without problems

cog.rusty’s picture

True, this is strange. The correct pictures path in admin/user/settings should be just pictures. The sites/default/files part will be taken from the admin/settings/file-system page.

What is the exact error message when you have created a pictures subdirectory yourself and have made it 777?

What is the error message when you don't have a pictures subdirectory but you have set sites/default/files to 777?

No complaints about the files directory in admin/reports/status? Anything reported in the logs in admin/reports?

rogerwebb’s picture

Setting the box to just "pictures" with no "pictures" in place under sites/default/files but with "files" set to 777 the error message comes up

•The directory does not exist.
•The settings have not been saved because of the errors.

Creating sites/default/files/pictures also with the 'files' set to 777 gives the same result

You can see for yourself by logging into www.retiredbutactive.com and signing in with username and password cog.rusty which has been set up as a temporary webmaster

The 'pictures' file has been deleted

http://retiredbutactive.com/admin/reports/status shows nothing unusual and
http://retiredbutactive.com/admin/reports/dblog nothing unexpected

Roger

cog.rusty’s picture

Remember to disable the account that you created for me immediately, in case someone gets the idea to play around with your site to "improve" it.

Also, the admin/reports/status page says that you have unprotected your update.php file and someone may run it and select the wrong updates manually, which could ruin everything. Protect it again.

-----------

I did take a look and confirmed that the "pictures" directory can't be created, either under "sites/default/files" or under "sites/default/files/users" which I noticed that you have set now.

However I can't see the permissions of the directories, so I can't say much.

If you set the files directory to 777 with FTP, did you verify that your setting was applied?

Also,
1) run a phpinfo() -- upload a phpinfo.php file containing <?php phpinfo(); ?> and browse to it to run it, to see if it mentions anything about "safe_mode" or "open_basedir". (Those can affects the ability of PHP to create directories.)

2) In your .htaccess file, add the lines:

php_flag log_errors 1
php_value error_log php-errors.log

and then
- upload or create an empty text file named php-errors.log in your drupal directory and set its permissions to 666
- try to save the "pictures" directory setting again
- check the php-errors.log file to see if it recorded any errors. What does it say?

rogerwebb’s picture

First of all, thanks for your efforts to clear this.

Right

1 Security issues dealt with

2 1) run a phpinfo() -- upload a phpinfo.php file containing phpinfo(); and browse to it to run it, to see if it mentions anything about "safe_mode" or "open_basedir". (Those can affects the ability of PHP to create directories.)
Done

Results by using search facilities

safe_mode Off Off
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin
safe_mode_gid Off Off
safe_mode_include_dir no value no value

safe_mode_allowed_env_vars PHP_ PHP_
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH

open_basedir no value no value

3 2) In your .htaccess file, add the lines:

php_flag log_errors 1
php_value error_log php-errors.log

and then
- upload or create an empty text file named php-errors.log in your drupal directory and set its permissions to 666
- try to save the "pictures" directory setting again
- check the php-errors.log file to see if it recorded any errors. What does it say?

Site won't run - failure notice on browser

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webadmin@kundenserver.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Therefore php-errors.log file still blank

The .htaccess was restored as before and the site is now up

I don't know but i have a Drupal 6.10 site (www.lifes3rdphase.com) which has never used pictures in profiles and the module worked first time when I used it. I am thinking of reverting www.retiredbutactive.com back to 6.10 tho that has declared security issues

Roger

cog.rusty’s picture

Hmm... OK, there is no problem with safe_mode or open_basedir.

Your server doesn't accept in .htaccess the things that I suggested, so you could try to do it in your sites/default/settings.php file by adding the lines:

ini_set('log_errors', 1);
ini_set('error_log', 'php-errors.log');
rogerwebb’s picture

Have done that but php-errors.log remains empty and the pictures file uncreated.

Some additional pointers

  1. I set up a d6.10 site using the same data base but the error re-occured there
  2. The avatar_selection dis set up /sites/default/files/avatar_selection without a problem
  3. The module worked on www.lifes3rdphase.com which is still on D6.10
  4. Creating a new D6.10 site pointing at the same www.retiredbutactive.com database produced the same poblem suggesting the the module in 6.11 has made some changes in the database that prevents the setup process after the first attempt.
    1. Hope this helps

cog.rusty’s picture

The only database query run in the 6.10->6.11 update was one which was clearing the menu cache.

Have you checked whether the problem occurs with a completely new installation?

rogerwebb’s picture

A new D6-11 with a virgin db works immediately with 'pictures' coming up as the default directory coming up with permissions set as 775

cog.rusty’s picture

Do you have any custom RewriteRules in the existing site's .htaccess file? Any different RewriteBase setting?

rogerwebb’s picture

No nothing like that

buzzman’s picture

Hello:

I can confirm that I have the exact same problem here.

The first time round after initial install, the "pictures" directory was created, it was working fine but as soon as I changed some of the User Settings options and tried to save the form, this error appears. It won't create a new "pictures" dir even if I delete the older one and complains by throwing the above errors.

This is very strange and problematic.

Also, say after this is fixed, how & what variable do I / can I add in this path so that a particular user's picture gets saved to his/her own folder?

I tried putting the following PATH and this error turned-up in the first place:

USERDIR/[user]/pics

So then I removed this data in the db/table > variables > "user_picture_path" value back to:

user_picture_path VALUE s:8:"pictures";

Now when I go back to the User Settings page, soon as it loads it complains that the directory doesn't exist and won't create it either (since I deleted the original folder) if the form is saved.

Can someone plz help with this or point me in the right direction? I have tried Googling Drupal site with this page as the result and so doesn't look like there are any other reports but maybe I'm not searching with the right keywords.

Thanks for looking.

buzzman’s picture

I went in and deleted the value for the item "file_directory_path" in the db table "variables". The value was set as this: s:8:"pictures";

You may elect to change the value to this which is same as deleting the whole value as Drupal will insert this when it's found to be empty: s:0:"";

next, delete the dir "pictures" if it's there.

then, goto the user settings pg in admin and blank out this field: Picture image path

lastly, save the page and all should be back to normal. you may then add whatever dir (even "pictures") and this time it should save that correctly and no errors will be thrown.

well, that solves the errors. but I still need to figure out how to add the var to the PATH value in the above field "Picture image path" such that for every user it's their own user dir PATH added auto when they upload thier profile picture?

the above settings puts ALL USERS pictures in the pictures dir, which is not really the way to go as I have assigned every user their own dir for whatever images they upload throughout the site in different areas. in these areas, the user is able to invoke the IMCE tool to go directly in their own folder and uplaod stuff. so I'm looking to have the profile image uplaod the same way. Of course I'll have to disable the default upload and add link to the IMCE tool to do that. but how do I assign the user dir dynamically as explained above?

Any help in this regard is very much appreciated.

Thanks again.

WorldFallz’s picture

For the permissions problem check the perms on the entire tree-- i've had problems before where the perms on 'default' messed with everything below it.

As for the token issue-- afaik, the user picture path setting does not support tokens. Looks like the http://drupal.org/project/reg_with_pic module might provide this as one of it's features though.

buzzman’s picture

Hi WorldFallz:

Really appreciate the quick reply. There was no permissions problem for me for the above errors though. And about the mod you recommended, I checked it out but sadly it doesn't fit my requirement as I don't want to have picture upload in the reg form. It's to be available via User's profile page and for this the User Settings comes into play, since the config for the PATH is a GLOBAL setting here.

So I definitely need to somehow have the user's assigned USER_DIR injected in this PATH. but as you said Tokens are not supported here.

Any other ideas or maybe code that I can add/replace in the User Settings form in the core that will inject the USER_DIR in the PATH such as below?

USERDIR/(inject_username_here)/pictures

Thanks again for your help.

WorldFallz’s picture

You might be able to alter the account form to inject the path manually via http://api.drupal.org/api/function/hook_form_alter -- seems a little hamfisted to me but it should work.

buzzman’s picture

Hi again,

I can't get it done using /hook_form_alter either as I can't figure out what code will do the trick since I believe we need to be inserting the var/token in the value which will then be auto populted once the user is on his profile page.

If you think this can be done though, is it possible to share some code? i have been at it sporadically and still beating about the bush it seems.

Thanks for your help.

WorldFallz’s picture

I'm no php genius, and with the holidays upon us i have very little in the way of spare time this month, but I'll try to take a look and post back with some code if I can.

buzzman’s picture

hullo WorldFallz:

greetz for the new year and just checking to see if you found a solution :-)

thanks & cheers

twistdev’s picture

I've tried chmodding every directory in the sequence up to 777.
I've added the subdirectory to every directory in the path (with the permissions set to 777).
I've checked to make sure that the serialized version of the path was being used in the database.
I've used the reset button and tried to disable image support, but keep getting the, "The settings have not been saved because of the errors" error. Any suggestions at this point would be great.
I don't even have file_directory_path in the variables table.

I'm running on:
FreeBSD 7.2
PHP 5.2.12
Drupal 6.15
Apache 2.2.14

Thanks

cog.rusty’s picture

Your last sentence makes me wonder. What paths do you have in the /admin/settings/file-system page? Have you set any paths at all?

twistdev’s picture

Thank you for the reply. I had checked the paths, as well:
sites/default/files
and /tmp (in a publicly viewable directory, just one directory above my drupal install)

Download method is set to:
Public - files are available using HTTP directly.

all directories exist and have been chmodded to 777 permissions-wise.

...also, checked the database again, I was mistaken about missing file_directory_temp and file_directory_path . I must have missed it in the thrash of trying to figure this aggravation out.

Fortunately I'm early enough on in this install to just reinstall and see what happens.

twistdev’s picture

I reinstalled, and was able to get this to work. I hope noone else runs into this problem.