With unvaluable help from people on StackOverflow I managed to run a bash script from php. Now everything is running fine but as the script takes some minutes to end I would like to see progress. In the bash script there are some printf commands that output error/success messages.
As a newbie in php I assumed those messages would appear as they are executed in the bash script. But I don't get any output although the script is finished. I can see the files created and for sure the script finished but I can't see any output from php in the browser.
How can I check the progress when the script is still running? Why php does not seem to end?
Following is the php script.
<?php
echo "<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=Content-Type content=text/html; charset=UTF-8 />
<title>Title</title>
<link href=../style.css rel=stylesheet type=text/css>
</head>
<body topmargin=0 leftmargin=0>";
echo '<font color=blue>';
echo '------------------------------------------------------------- <br>';
echo 'Inicio de la generación manual de mapas de olas de calor<br>';
echo 'Este proceso tarda varios minutos<br>';
echo '-------------------------------------------------------------<br>';
echo date('h:i:s') . "\n";
$output = shell_exec('/home/meteo/www/RAMS/olas/generar-mapas.bash');
echo "<pre>".$output."</pre>";
echo '</font>';
echo '</body>';
echo '</html>';
?>
I've read some posts in the forum about php, Ajax and jQuery for progress bars but I just know some very basic php. Is there a simple solution for a novice in php? Thanks for your help
echoabsolutely everything. You can simply close the?>, output HTML, then reopen the<?phpwhen you need to. Pro HTML Tip: the<font>tag is very old-fashioned and should no longer be used. If you want the font to be blue, use CSS.echoappears. Sorry if too basic but what does close?>means? Is it not closed? the html output does not appear. Thanks for answering.