网站首页 > 资源文章 正文
最近电脑系统重新安装,然后环境也重新搭建了,这不各种奇葩的vagrant问题一个接一个,现在PHP学习网把遇到的问题记录在下,只要碰到的问题,便会断断续续记录在下。
所用版本
1、VirtualBox-5.1.26-117224-Win.exe
2、vagrant_1.9.8_x86_64.msi
3、ubuntu-14.04-amd64-vbox.box
4、系统window10
问题一:window数据无法同步到虚拟机
报错信息:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
解决办法:安装vagrant-winnfsd插件。
vagrant plugin install vagrant-winnfsd
完成后重启,看看效果。
问题二:open_basedir问题(已不属于vagrant的问题)
open_basedir:将 PHP 所能打开的文件限制在指定的目录树,包括文件本身。本指令不受安全模式打开或者关闭的影响。
根据我的理解说一下,大体目录如下目录树,我们将网站的运行目录指定到web目录下面,在index.php中若是用require引用Model,便会出现报错。
├── Common
├── Domain
├── Model
└── Public
├── Web
│ └── index.php
└── init.php
报错信息
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/www.viphper.com/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/www.viphper.com/frontend/web/:/tmp/:/proc/) in /home/wwwroot/www.viphper.com/frontend/web/index.php on line 8
Warning: require(/home/wwwroot/www.viphper.com/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/www.viphper.com/frontend/web/index.php on line 8
Fatal error: require(): Failed opening required '/home/wwwroot/www.viphper.com/frontend/web/../../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/www.viphper.com/frontend/web/index.php on line 8
此错误在使用Yii2框架时,是比较容易出现的。
解决方法,打开/usr/local/nginx/conf/fastcgi.conf 文件,在文件的最后一行我们可以看到
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
修改为:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/home/wwwroot/:/tmp/:/proc/";
注意:/home/wwwroot/ 为你网站的执行目录,根据自己的配置修改。
问题二:vagrant本地目录和虚拟机目录同步问题
vagrant总是给人惊喜,用着用着就坏了,坏了就得解决问题,出现的错误信息如下
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
仔细阅读以下,说是没办法同步目录。各种查找后找到解决方法,安装增强工具。
sudo apt-get install virtualbox-guest-utils #虚拟机上执行
然后重启 vagrant reoad,问题解决。
猜你喜欢
- 2024-09-27 JDK 14 新特性-你还跟得上吗(jdk各版本新特性)
- 2024-09-27 深入JVM——理解Java的类加载机制
- 2024-09-27 SAP License:如何导入License(sap导入不成功是什么原因)
- 2024-09-27 cmd命令提示符大全(命令提示符常用代码)
- 2024-09-27 Win10左下角的开始键没有了怎么办【详解】
- 2024-09-27 由浅入深:一个简单的例子,让你吃透Go语言自定义的包管理
- 2024-09-27 自己创建多语言Windows10安装盘,想安什么语言版本随便挑
- 2024-09-27 微软Win10 KB5010342 (20H2/21H1/21H2)累积补丁发布
- 2024-09-27 FCKeditor上传漏洞的总结分析(fck编辑器漏洞)
- 2024-09-27 干货:如何一分钟解决Windows 10崩溃问题
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 电脑显示器花屏 (79)
- 403 forbidden (65)
- linux怎么查看系统版本 (54)
- 补码运算 (63)
- 缓存服务器 (61)
- 定时重启 (59)
- plsql developer (73)
- 对话框打开时命令无法执行 (61)
- excel数据透视表 (72)
- oracle认证 (56)
- 网页不能复制 (84)
- photoshop外挂滤镜 (58)
- 网页无法复制粘贴 (55)
- vmware workstation 7 1 3 (78)
- jdk 64位下载 (65)
- phpstudy 2013 (66)
- 卡通形象生成 (55)
- psd模板免费下载 (67)
- shift (58)
- localhost打不开 (58)
- 检测代理服务器设置 (55)
- frequency (66)
- indesign教程 (55)
- 运行命令大全 (61)
- ping exe (64)
本文暂时没有评论,来添加一个吧(●'◡'●)