1. Go to this page and download the library: Download crit/php-exec-jobs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crit / php-exec-jobs example snippets
$interface = $_GET['interface'];
$interface = escapeshellarg($interface); // sometimes this step is incorrectly skipped by developers
$ip = exec("ip addr show dev $interface |grep inet |awk '{print $2}'");
echo $ip;
use Crit\ExecJob\Job;
$job = new Job();
// optionally change the wrapping for named arguments
// defaulted to '<', '>'
// $job->setArgWrapper(':', ':');
// optionally change the shell working directory
// defaulted to the current working directory of the PHP process
// $job->setWorkingDirectory('/sbin');
// optionally set ENV variables for this job
// $job->setEnv('CUSTOM1', 'special-value-1');
// $job->setEnv('CUSTOM2', 'special-value-2');
$job->arg('firstname', $_GET['firstname']); // John
$job->arg('lastname', $_GET['lastname']); // Doe
$job->arg('interface', $_GET['interface']); // eth0
$job->must('echo "<firstname> <lastname>"'); // stops here if shell errors
$job->may('ip addr show dev <interface> |grep inet |awk \'{print $2}\''); // will not stop here if shell errors
$job->may('ifconfig <interface> |grep inet |awk \'{print $2}\''); // will not stop here if shell errors
$job->must('/sbin/someCustomScript <firstname> <lastname>');
$ok = $job->run(); // run commands in order
echo "Output: " . json_encode($job->output());
echo "Errors: " . json_encode($job->errors());
echo $ok ? "Run successful" : "Run failed";
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.