Ao tentar conectar ao phpweb no navegador, aparece a mensagem: Testando conexao
Conexão falhou: Connection refused
Vagrantfile: config.vm.define "phpweb" do |phpweb| phpweb.vm.network "forwarded_port", guest: 8888, host: 8888 phpweb.vm.network "public_network", ip: "192.168.15.64"
phpweb.vm.provision "shell",
inline: "apt-get update && apt-get install -y puppet"
phpweb.vm.provision "puppet" do |puppet|
puppet.manifests_path = "./configs/manifests"
puppet.manifest_file = "phpweb.pp"
end
end
phpweb.pp: exec { 'apt-update': command => '/usr/bin/apt-get update' }
package { ['php7.2', 'php7.2-mysql']: require => Exec['apt-update'], ensure => installed, }
exec { 'run-php7': require => Package['php7.2'], command => '/usr/bin/php -S 0.0.0.0:8888 -t /vagrant/src &' }
index.php: <?php echo "Testando conexao "; $servername = "192.168.15.64"; $username = "phpuser"; $password = "pass";
// Create connection $conn = new mysqli($servername, $username, $password);
// Check connection if ($conn->connect_error) { die("Conexão falhou: " . $conn->connect_error); } echo "Connetado com sucesso"; ?>