我有两台机器(linux,Mac),需要使用vagrant来管理vm。在Liux中使用VirtualBox,而在Mac中使用parallels。所以我在vagrant配置文件中配置了这两个提供程序,如下所示:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<?php
// Check if there is a valid $_POST request that is not empty
if ($_POST)
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$call= $_POST['callBack'];
$party = $_POST['party'];
$message = $_POST['message'];
$formcontent="From: ".$name."\nPhone: ".$phone."\nCall Back: ".$call."\nParty Size: ".$party."\nMessage: ".$message;
$recipient = "me@gmail.com";
$subject = "New Private Party Submission";
$mailheader = 'From: '.$name.' <'.$email.'>';
$mailResult = mail($recipient, $subject, $formcontent, $mailheader);
// better to store mail result in a variable
if($mailResult)
{
header("Location: https://example.com/thank-you");
exit();
// use exit to terminate program and exit to header location
}
}
?>
<form action="" method="POST">
<table>
<tr>
<td><label for="name">Name: </label><input type="text" id="name" name="name" value="" /></td>
</tr>
<tr>
<td><label for="email">Email: </label><input type="text" id="email" name="email" value="" /></td>
</tr>
<tr>
<td><label for="phone">Phone: </label><input type="text" id="phone" name="phone" value="" /></td>
</tr>
<tr>
<td><label for="callBack">Call back: </label><input type="text" id="callBack" name="callBack" value="" /></td>
</tr>
<tr>
<td><label for="party">Party: </label><input type="text" id="party" name="party" value="" /></td>
</tr>
<tr>
<td><label for="message">Message: </label><textarea id="message" name="message" ></textarea></td>
</tr>
</table>
<input type="submit" value="clickToEnter" />
</form>
</body>
</html>
在我的mac系统上,当我在命令下运行时却出错了:
Vagrant.configure('2') do |config|
agrant.configure('2') do |config|
config.ssh.forward_agent = true
config.ssh.password = 'crunch'
config.vm.box = 'ubuntu/xenial64'
config.vm.provider 'virtualbox' do |vb|
vb.gui = true
vb.memory = '8192'
vb.name = 'ubuntu'
end
config.vm.provider 'parallels' do |vb|
vb.gui = true
vb.memory = '8192'
vb.name = 'ubuntu'
config.vm.box = 'parallels/ubuntu-14.04'
end
我已经安装了所需的提供商:
$ vagrant up --provider parallels
An active machine was found with a different provider. Vagrant
currently allows each machine to be brought up with only a single
provider at a time. A future version will remove this limitation.
Until then, please destroy the existing machine to up with a new
provider.
Machine name: default
Active provider: virtualbox
Requested provider: parallels
那么为什么$ vagrant plugin list
docker (0.4.0)
vagrant-parallels (1.7.8)
vagrant-share (1.1.9, system)
vagrant-vbguest (0.15.0)
没有选择vagrant
参数?
答案 0 :(得分:2)
这是流浪汉的current limitation
你不能用VirtualBox和VMware支持同一台机器 融合。这是将在未来版本中删除的限制 Vagrant。
我不确定它是否会被流浪者解决。但是你已经用virtualbox创建了一次你的机器,所以现在你需要使用这个VM,而不是另一台机器。
解决此问题的一种方法是使用现有VM的引用(.vagrant
)备份.vagrant.vbox
文件夹,然后重新运行vagrant up --provider parallels
以创建parallels VM。
如果要切换回虚拟机VM,可以备份新创建的.vagrant
文件夹,并将.vagrant.vbox
重命名为.vagrant