简体   繁体   English

Vagrant file_put_contents权限被拒绝

[英]Vagrant file_put_contents permission denied

I cannot seem to allow permissions in vagrant. 我似乎无法允许流浪汉的权限。 I am attempting to run importbuddy.php in order to migrate a WordPress instance. 我试图运行importbuddy.php以迁移WordPress实例。 I get the following error. 我收到以下错误。

file_put_contents(/path/): failed to open stream: Permission denied

I have setup permissions to 777 on the www directory, but that changes nothing. 我在www目录上设置了777的权限,但没有任何改变。 Any idea on how to fix this? 有关如何解决此问题的任何想法?

While recursively setting folder and file permissions to 777 should fix your problem (instructions for doing so here ), the root of this is probably an issue with the ownership of the files and folders. 递归设置777的文件夹和文件权限应该解决您的问题( 这里的说明 ),这可能是文件和文件夹的所有权问题的根源。

The owner of shared folders is usually 'vagrant' but the server itself (if you're using Ubuntu) runs as user and group 'www-data'. 共享文件夹的所有者通常是“流浪者”,但服务器本身(如果您使用的是Ubuntu)作为用户和组“www-data”运行。 You can view the user/group of your files by sshing into your VM ( vagrant ssh ), navigating to the directory in question and entering ls -l in your console. 您可以通过sshing到VM( vagrant ssh ),导航到相关目录并在控制台中输入ls -l来查看文件的用户/组。

If you're running apache, then you can update the user to 'vagrant' by editing the following file ( /etc/apache2/envvars ) like below: 如果你正在运行apache,那么你可以通过编辑以下文件( /etc/apache2/envvars )将用户更新为'vagrant':

Find this section 找到这个部分

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

And change it to 并改为

export APACHE_RUN_USER=vagrant
export APACHE_RUN_GROUP=vagrant

Afterward just be sure to restart apache (with this command sudo service apache2 restart ) and the file permission errors should be fixed 之后只需确保重启apache(使用此命令sudo service apache2 restart )并修复文件权限错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 file_put_contents权限被拒绝+ livedocx - file_put_contents permission denied + livedocx file_put_contents():connect()失败:AWS服务器中的权限被拒绝 - file_put_contents(): connect() failed: Permission denied in AWS server apache php file_put_contents权限被拒绝 - apache php file_put_contents permission denied file_put_contents权限被拒绝-没有777的解决方案吗? - file_put_contents permission denied — any solution without 777? file_put_contents无法打开流:权限被拒绝 - file_put_contents failed to open stream: Permission denied file_put_contents - 无法打开流:权限被拒绝 - file_put_contents - failed to open stream: Permission denied file_put_contents无法打开流:权限被拒绝 - file_put_contents failed to open stream: Permission denied Codeigniter file_put_contents:未能打开 stream:权限被拒绝 - Codeigniter file_put_contents: failed to open stream: Permission denied 警告:file_put_contents():无法打开流:权限被拒绝 - Warning: file_put_contents(): failed to open stream: Permission denied file_put_contents(文件路径/文件)[function.file-put-contents]:无法打开流:权限被拒绝 - file_put_contents(filepath/file) [function.file-put-contents]: failed to open stream: Permission denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM