How do I export terraform output to a log file using PHP?
Get the solution ↓↓↓I have created a PHP page where I can read the console output of terraform. But I am having issues exporting these outputs to a log file. I tried using fwrite but I got a blank file. I am using the code below to get the near to real time output of terraform.
if (isset($_POST['button1']))
{
$cmd1 = 'C:\terraform\terraform.exe init';
while (@ ob_end_flush()); // end all output buffers if any
$proc1 = popen("$cmd1 2>&1", 'r');
echo '<pre>';
while (!feof($proc1))
{
echo fread($proc1, 4096);
@ flush();
}
echo '</pre>';
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.