Php Exec/usr/bin/latex

Php Exec/usr/bin/latex,php,latex,exec,Php,Latex,Exec,当我尝试以下PHP代码时: 执行官“/usr/bin/latex…” 我会得到127出口代码。我能做些什么来阻止这一切 问候,, Kevin为什么不使用ssh2 大概是这样的: //Connect first if (!($con = @ssh2_connect('192.168.0.1', 22))) { echo "[FAILED_CONNECT]\n"; exit(1); } if (!@ssh2_auth_password($con, "your_user", "y

当我尝试以下PHP代码时: 执行官“/usr/bin/latex…” 我会得到127出口代码。我能做些什么来阻止这一切

问候,, Kevin为什么不使用ssh2

大概是这样的:

//Connect first
if (!($con = @ssh2_connect('192.168.0.1', 22))) {

    echo "[FAILED_CONNECT]\n";
    exit(1);

}

if (!@ssh2_auth_password($con, "your_user", "your_password")) {

    echo "[FAILED_AUTH_DENIED]\n";
    exit(1);

}
echo "[OK]\n CONNECTED!";


// the command line
$stdout_stream = ssh2_exec($con, "/usr/bin/latex ...");


// close connection
fclose($stdout_stream);

127错误代码表示bash未找到该命令。是否确实安装了latex?

其他参数是什么?“/usr/bin/latex-interaction=nonstopmode”$texfile命令的输出是什么?它应该描述您遇到的问题。尝试重新路由输出,以便php可以看到它,您可能会得到更好的错误消息:exec'/usr/bin/latex-interaction=nonstopmode'$texFile。”2> &1',$output;打印r$输出;没什么,我执行了“..”、$a、$b,这些变量在执行后包含127,数组为空。为什么要使用ssh连接到localhost?@SVICK它说localhost在哪里????阅读后先投下一票,但如果不明白要点,不要投下一票给任何人。。伟大的exec在当前计算机上执行代码,因此它隐式地表示为localhost。不需要尖叫。192.*是localhost;。此外,您的caps lock已打开。@KEvin Er…192.168.*.*是本地C类网络,但不一定是本地主机。现在,127.*.*是localhost。是的,当我回显代码并以root用户身份手动执行时,它可以被执行。@Kevin,对/usr/bin/latex有什么权限?www数据用户或您的apache实例运行的任何人是否具有执行权限?0777,www数据,我想是的,因为它是0777?我非常担心每个人都可以编写的可执行文件。哦,等等,也许它是一个符号链接,而真正的文件有不同的权限?