via script: How to execute shell scripts

Step 1:

Please note that not all shell scripts or shell commands can be executed using this script, since some commands are locked due to security reasons.

It is also possible that larger scripts may be aborted in case they reach the server's limits and restrictions.


Create a file with a random name, e.g. cgi-bridge.php

This files must have the following content:

<?php
exec("/bin/bash Path to the script  2>&1", $out, $result);
echo "Returncode: " .$result ."<br>";
echo "Script output: " ."<br>";
echo "<pre>"; print_r($out);

?>

The script needs to be invoked via your domain:

http://www.yourdomain.de/cgi-bridge.php

The script can also be used for Perl
exec("/usr/bin/perl Path to the script  2>&1", $out, $result);

Python
exec("/usr/bin/python Path to the script  2>&1", $out, $result);

PHP*
exec("/usr/bin/php Path to the script2>&1", $out, $result);

If included in your webhosting plan, you can also set up this script as cronjob.

Step 2:

* Using the path "/usr/bin/php", the server's default PHP-CLI version will be addressed. In case you want to use a certain PHP version, you need to specify its respective path. Currently, the following PHP versions are installed:

PHP 5.6.x - /usr/bin/php56

PHP 7.2.x - /usr/bin/php72

PHP 7.4.x - /usr/bin/php74

PHP 8.x - /usr/bin/php80

PHP 8.1.x - /usr/bin/php81

PHP 8.2.x - /usr/bin/php82
How helpful was this tutorial?

Search in support and FAQ

Seitensuche