PhpStorm - Deployment - Cannot Upload New Files
Solution 1
You can try this :
chmod -R 777 /var/www
chgrp www-data /var/www
chown -R www-data /var/www
useradd -G {www-data} your_username
Solution 2
Checklist:
- Make sure you own the files, so if you are in the
sudo
group then you can dosudo chown -R myusername:sudo /var/www/html/test/
. This is to make sure that it will also work for other people in the group. - Make sure that you have write permissions, i.e. read and write access also for the group. You can do this with
sudo chmod -R 755 /var/ww/html/test/
(Unfortunately I have found that in practice you sometimes need 777 permissions, but this is not desirable.) - Make sure your deployment path mappings are correct, by going to Settings | Deployment | Mappings, and check that the Deployment path is indeed relative to the root path (under Connection)
Solution 3
Prior to deleting, modifying and transferring files, you need to give them the permissions to the data group for the user who will perform the operations.
$ sudo usermod -a -G www-data your_username
$ sudo chgrp -R www-data /var/www/html
$ sudo chmod -R g+w /var/www/html
Solution 4
The issue solved itself after restart.
PhpStorm support gave this answer: Please try to run File > Invalidate Caches/Restart > Invalidate and Restart.
If it still fails please send me idea.lof file as described here: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files
Comments
-
Bxx 12 months
When I try to create a new file/folder in PhpStorm I get a
Permission denied
error. However, when I create a new file in a folder that already exists in the root directory of my server I can without any errors.When I try to create a new file:
[2016-03-07 11:29 AM] Failed to transfer file 'C:\Users\D\PhpstormProjects\example2\test.php': could not write to "sftp://www.example.com/test.php". (Permission denied) [2016-03-07 11:29 AM] Automatic upload completed in less than a minute: 2 items failed
When I try to create a new folder:
[2016-03-07 11:27 AM] Failed to create folder '/var/www/html/test': could not create folder "sftp://www.example.com/test". (Permission denied) [2016-03-07 11:27 AM] Automatic upload completed in less than a minute: 1 item failed
-
Bxx about 7 yearsI get
chgrp: invalid groupd: 'www-data'
-
L. Guthardt about 5 yearsWhile this code snippet may be the solution, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
-
Goddard over 2 yearsYou should never tell some one to use permissions 777.
-
matt over 2 yearsClearing caches seems to have solved the issue. My flavor of the error message had
(Indicated packet length 1416128883 too large)
added to it. Server-side permissions were correct,ssh server
worked fine, but PHPStorm still wasn't able to connect until I flushed its caches. -
ctrlbrk about 1 yearJust another +1 for File > Invalidate Cache and restart, worked for me.