Suppressing output from exec() calls in PHP

后端 未结 4 2120
灰色年华
灰色年华 2020-12-15 17:33

I have a number of command line scripts in PHP that use exec() to perform tasks such as restarting services, loading MySQL timezone files, etc. While exec() itself does not

4条回答
  •  时光取名叫无心
    2020-12-15 18:13

    Redirecting stderr alone should not influence where processing takes place, just make sure not to add an &. It should only run in the background if you redirect the output and make it run in the background.

    Edit:

    Cracked open cygwin, you need to redirect stderr for the first command, give this a try:

    $command = 'mysql_tzinfo_to_sql /usr/share/zoneinfo 2> /dev/null | mysql mysql';
    exec($command, $output, $result);
    

提交回复
热议问题