When i try to upload php file using vsftpd to /var/www/ and visit the file from web server i got this error,
Warning: Unknown: failed to open stream: Permission denied in Unknown
on line 0
Fatal error: Unknown: Failed opening required
'/var/www/.../.../public_html/d.php'
(include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
i tried chown -R www-data:www-data /var/www after that the error got fixed but i have to do the same every time i upload a new file, is there is anyway to fix that for all new files?
The best way is to apply an ACL to the directory in question.
This will set the default so new files and folders are given the ACL, this says that the group of www-data will have read,write,execute permissions by default on all files/folders from /var/www recursively
sudo setfacl -Rdm g:www-data:rwx /var/www
This will set the ACL for existing files and folders, this says that the group of www-data will have read,write,execute from /var/www recursively for existing files and folders
sudo setfacl -Rm g:www-data:rwx /var/www
Related
I am getting this exception. How can I fix it?
Exception – yii\base\Exception
Failed to create directory "/var/www/html/sitr/runtime/cache": mkdir(): Permission denied
↵
Caused by: yii\base\ErrorException
mkdir(): Permission denied
in /var/www/html/site/vendor/yiisoft/yii2/helpers/BaseFileHelper.php at line 624
sudo chmod -R 775 /var/www/html/sitr/runtime
runtime folder keeps generating the files, allow it to do that.
sudo chmod 777 -R /var/www/html/sitr/runtime
I want to upload an image. Every time I try to upload the image I recieve the error message found below.
I have already set the permissions to read&write:
Warning: move_uploaded_file(uploads/1000020170620022532img3.png):
failed to open stream: Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php
on line 41
Warning: move_uploaded_file(): Unable to move
'/Applications/XAMPP/xamppfiles/temp/phpYqSkvp' to
'uploads/1000020170620022532img3.png' in
/Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php
on line 41
Friend, You only need only to create the directory where are your .php file is found:
uploads/
And change the Only write in the folder
Please use below code:
move_uploaded_file($_FILES['image']['tmp_name'],'uploads/1000020170620022532img3.png');
If this code is not working please check path and folder permission.
try this in terminal
sudo chmod -R 777 upload/
p.s. got to the upload directory and run sudo chmode -R 777 directly.
I am working on a project hosted at 27littlethings.com and I can't seem to get rid of this error:
Warning:
fopen(/home/a27lifdy/public_html/system/storage/logs/error.php):
failed to open stream: Permission denied in
/home/a27lifdy/public_html/system/library/log.php on line 6
I have tried to change the file permissions on the specified file but the problem is not going away.
Change the permissions on the file in question:
chmod 755 /home/a27lifdy/public_html/system/storage/logs/error.php
or
chmod 777 /home/a27lifdy/public_html/system/storage/logs/error.php
You can also try just changing the permission on the folder:
chmod 777 /home/a27lifdy/public_html/system/storage/logs/
I am getting this error / warning:
Warning: imagejpeg(): Unable to open
'/var/www/my_web/data/my_web/www/users/avatars/user125.jpg' for
writing: Permission denied in
/var/www/my_web/data/classes/class.Image.php on line 157
On line 157, there is
imageJPEG($image, $this->destPath, $this->jpgQuality);
My avatars folder has permission set to 777, $this->destPath is '/var/www/my_web/data/my_web/www/users/avatars/user125.jpg'
How could I solve this problem?
Set destination path to 777 permission with user www-data
be careful with the user-group : www-data
chmod -R 777 /var/www/my_web/data/my_web/www/users/avatars/
"The "-R" stands for "recursive" which means that the command will affect every single file within the directory you choose." (from comments #lefdilia)
You should set 777 permission for jpeg file too.
Check permission of jpg.
I installed Drupal 7 in a web host successfully.
After installing a module, I got an error errors and and status report gave me this error message:
File system Not writable
The directory /Applications/MAMP/tmp/php does not exist.
You may need to set the correct directory at the file system settings page or
change the current directory's permissions so that it is writable.
I check the permissions for (sites/default/files) and it has 755 permissions and I change it to 777 but nothing happened so I return it back.
I have the following setting for (Home » Administration » Configuration » Media):
Public file system path
sites/default/files
Temporary directory
/Applications/MAMP/tmp/php
and here is the error I am getting:
Warning: file_put_contents(temporary://fileDyFbDg) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://fileeTFMpl) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://fileuB8Tdu) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://filea1KYXG) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Please advice.
I check the permissions for (sites/default/files) and it has 755 permissions and I change it to 777 but nothing happened so I return it back.
do the same for /Applications/MAMP/tmp/php
This reply is for non-windows sites :
In my case, the sites/default/files/ folder was set to 775 ( not a good idea to have it set to 777 )
I had to delete the following folder :
rm -rf /tmp/devel_themer/
Then it worked !
The error happens, because your temporary directory is not writable by your web server user.
You may check that in admin panel by going to Reports and Status report at: /admin/reports/status.
To fix it, you've to got to File system in Configuration (at /admin/config/media/file-system), then change your temporary directory to point to your writable directory. If that's correct, then make you set the right permission on it, e.g.
sudo chmod -R 777 /Applications/MAMP/tmp/php
and the same for default files folder:
sudo chmod -R 777 sites/default/files
Drush
If you're using drush, check which folder is set currently by:
drush vget file_temporary_path
Then to fix it, try:
drush vset file_temporary_path /tmp
Here are default temporary directories:
OS X: /private/tmp, for MAMP: /Applications/MAMP/tmp/php
Linux/Unix: /tmp