Besides, Python & Perl, PHP is another language mostly used in bioinformatics programming. In this article, we provide a simple command to execute shell commands in a PHP script.
shell_exec()
It runs command via shell and returns the output as a string.
syntax: $output = shell_exec($command);
If you are using variables inside your command, you need to use escapeshellarg().
syntax: $output = shell_exec($command);
Let’s assume, if you are running the blastp command on a query file with a variable filename, then it could be run like this:
$output = shell_exec("blastp -query ".escapeshellarg($filename.'.fasta')." -db /path/to/db -out output.txt");