【发布时间】:2010-04-26 22:40:42
【问题描述】:
我只是花了几个小时把头发拉出来。我正在尝试让 gcc 从 PHP 中编译一个文件。
$command = "/usr/bin/gcc /var/www/progpad/temp/tNu7rq.c -o /var/www/progpad/temp/tNu7rq.out";
exec($command, $output, $returnVal);
echo $returnVal."<br />"; //returns 1 and no output file created.
我在我自己的 ubuntu 服务器上运行它
/var/www/progpad/
/var/www/progpad/temp/
设置 chmod 777。如果我复制并粘贴命令字符串,然后将其粘贴到终端中,它会完美运行。
如果我用类似的东西替换命令字符串
$command = "echo test > test.txt";
那么创建文本文件就没有问题了。我在这里可能做错了什么???
【问题讨论】: