php中的exec()函数出错
我在php中从命令行运行程序时遇到一些问题。每当我在命令行中运行程序时,都会创建正确的文件,并且它工作得非常好。但是,当我把它放在php中并使用exec()函数时,什么都没有发生 最后,我希望用户能够选择他想要在外部程序上运行的参数,但现在我只是尝试在…中使用硬编码的值来运行它 下面是我用来从命令行运行程序的命令及其参数php中的exec()函数出错,php,database,command-line,exec,Php,Database,Command Line,Exec,我在php中从命令行运行程序时遇到一些问题。每当我在命令行中运行程序时,都会创建正确的文件,并且它工作得非常好。但是,当我把它放在php中并使用exec()函数时,什么都没有发生 最后,我希望用户能够选择他想要在外部程序上运行的参数,但现在我只是尝试在…中使用硬编码的值来运行它 下面是我用来从命令行运行程序的命令及其参数 [path1] -p blastp -d [parameter1] -i [path2] -e [parameter2] -m 9 -o [path3] where [p
[path1] -p blastp -d [parameter1] -i [path2] -e [parameter2] -m 9 -o [path3]
where [path1] is the path to ../blast-2.2.26/bin/blastall,
[path2] is the path to sample.fasta
[path3] is the path for the output file (you may want to create another folder for generating the output)
[parameter1] is the name of database chosen by the user from your page (eg. Human.db, Viruses.db, etc)
[parameter2] is the E-value given by the user from your page(eg. 0.0001, 1, 1000, etc)
我将在命令行中键入的实际代码是
~/blast/blast-2.2.26/bin/blastall -p blastp -d db -i ~/temp/sample.fasta -m 9 -o output'
这是到目前为止我的代码
<form method="POST", action="/~cs4380sp15grp4/home/blast.php">
<?php
session_start();
require_once '../secure/database.php';
$mysqli = new mysqli($dbhost,$dbuser,$dbpass,$dbname);
if($mysqli->connect_error){
exit('CON Error: ' . $mysqli->connect_errno . ' ' . $mysqli->connect_error);
}
//Insert the values into the database
if(isset($_POST['submit'])){
$db = $_POST['database'];
$evalue = $_POST['evalue'];
$sequence = $_POST['BlastSearch'];
exec('/students/groups/cs4380sp15grp4/blast/blast-2.2.26/bin/blastall -p blastp -d db -i /students/groups/cs4380sp15grp4/temp/sample.fasta -m 9 -o /students/groups/cs4380sp15grp4/temp/output');
}
?>
因此,我的exec函数在我的php页面中不起作用,因为相同的命令在终端中起作用。Apache服务器用户有权访问该程序吗?为确保安全,请尝试运行sudo chmod 755/students/groups/cs4380sp15grp4/blast/blast-2.2.26/bin/blastall,然后重试
同样,确保Apache进程可以访问输入和输出目录。停止发布相同的问题。。