Verifying your path to php is good

//**********************************************
//**********************************************
//********** IS PATH TO PYTHON VALID? **********
//**********************************************
//**********************************************
//Returns True, or error message string
/*
  $PathToPython = '/usr/bin/python3';
  $Result = IsPathToPythonValid($PathToPython);
  if ($Result !== True)
    echo "$Result<br>";
*/
function IsPathToPythonValid($PathToPython)
{
    if(!function_exists('shell_exec'))
      return('shell_exec() is not available. Please check your PHP configuration.');

    $EscapedPathToPython = escapeshellcmd($PathToPython);
    $Command = "$EscapedPathToPython -c \"print('python-ok')\"";     //A simple Python command to test it
    $Output = trim(shell_exec($Command . " 2>&1"));   //Execute the command and capture output
    
    if ($Output === 'python-ok')
      return(True);
    else
      return("Path is NOT valid or failed to run. Error: $Output\n");
}