Shell_exec没有执行命令?

I have the following code that, when a button is pressed, should send a post request to the following PHP file through ajax and run a command that uploads a hex file to an Arduino. But, when I press the button, nothing happens.

<?php

  if (isset($_POST['button'])) {
    $file = fopen('src/sketch.ino', 'w+');
    $code = $_POST['code'];

    fwrite($file, $code);

    echo "Form was submitted";

    shell_exec("avrgirl-arduino flash -f firmware.hex -a uno -p /dev/cu.usbmodem1421");

  } else {
    echo "Form has not been submitted";
  }

  shell_exec("platformio run");



?>