note 126545 deleted from function.exec by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 31 Oct 2021 03:15:49 +0000 |
| Subject: | note 126545 deleted from function.exec by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217128@lists.php.net to get a copy of this message | ||
Note Submitter: roger21 at nope dot free dot fr
----
if you get an error code, like 255 for instance, but can't see the error anywhere (logs,
output, files, whatever...) remember to redirect the errors somewhere within the command:
<?php
$command = "do_stuff -w params -o output";
// redirect the errors to an "errors.txt" file (if the current directory is writable by
php or specify a full path)
$command1 = $command." 2> errors.txt"
// or redirect the errors to the standard output (you get the errors in the $output parameter of
exec)
$command2 = $command." 2>&1"
// get the errors in "errors.txt"
$result = exec($command1, $output, $code);
// or get the errors in $output
$result = exec($command2, $output, $code);
?>