0

I recently installed one new Drupal (7.32) on a server that doesn't belong to me. Since then, I have a permission problem, I can't edit CHMOD rights and when I try to add new content (with image(s)), I can't. Here's the mistake returned by Drupal:

Warning: move_uploaded_file(): open_basedir restriction in effect.
File(/home/tmp/php/phpBKRRLYL) is not within the allowed path(s): (/home/tmp/sessions/:/home/XXX/public_html/:/home/XXX/shared) in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file(): open_basedir restriction in effect.
File(/home/tmp/php/phpBKRRLYL) is not within the allowed path(s): (/home/tmp/sessions/:/home/XXX/public_html/:/home/XXX/shared) in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file(/home/tmp/php/phpBKRRLYL): failed to open stream:
Operation not permitted in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file():
Unable to move '/home/tmp/php/phpBKRRLYL' to '/home/XXX/www/public_html/YYY/drupal-7.32/sites/default/files/anime.jpg' in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

As we can see, Drupal apparently uses the server's tmp directory (in which I have no rights) and I would like it to use another tmp directory in "/home/XXX/www/public_html/YYY/drupal-7.32/" so that I can add/edit content properly. How could I do this? By editing the "/includes/file.inc" file (if so, which line(s) shall I modify to do this?)? Something else?

NB: The system administrator is unavailable for an extended period so he can't change my rights for now. That's why it's important that I could change this tmp directory. Thank you!

1

You can edit the relevant setting in Configuration > Media > File system > Temporary directory (/admin/config/media/file-system).

You can choose any directory in your document root skipping the forward slash. I would recommend you to specify tmp. Take care of the permissions.

  • I tried by changing it to "/home/XXX/www/public_html/YYY/drupal-7.32/tmp" or "/sites/default/files/tmp", even "tmp", same problem. :/ – Kiritsu Oct 22 '14 at 12:41
  • Manually create a folder called tmp in your drupal root, then save the setting as tmp. – rooby Oct 22 '14 at 12:44
  • It's not working either. Just to be sure I'm not mistaken, I created a "temp" directory here : "/www/public_html/captainetwork/drupal-7.32/temp" with 775 rights and change the temp directory in file-system to "temp", is that the right way to do? – Kiritsu Oct 22 '14 at 12:52
  • If your base url is public_html then possibly (not sure) you need to specify captainetwork/drupal-7.32/temp or change your $base_url in settings.php. – Wtower Oct 22 '14 at 12:54
  • 1
    The temp directory has to be writable by the web server. So if you use 775 then either the owner or group of the folder must be that of the webserver. – rooby Oct 22 '14 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.