dongxian1921
dongxian1921
2011-11-02 04:01

从php运行动态shell脚本

已采纳

i've been writing a simple text to speech php script that works with festvox, i've been trying to use it but it seems the part i cant get is running the text to wave converter, shell script. here is the code i've created so far,

<form action="index.php" method="get">
Say: <input type="text" name="say" />
<input type="submit" />
</form>
<?php
$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $_GET["say"];
fwrite($fh, $stringData);
fclose($fh);
shell_exec('text2wave /var/www/text.txt -otype aiff -o /var/www/out.aiff');
?>

so i was wondering what possible errors i could have mad, any help?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dopuz8728 dopuz8728 10年前

    What error messages are you getting? But if I'd to guess from that code, and that shell_exec command works from the CLI, then try using the full path to the text2wave program.

    点赞 评论 复制链接分享

相关推荐