问题描述
Howdy,
最近我从Windows PC切换到Mac OS-X 10.5(php v5.2.6)和
我有一点问题我的cd-management脚本中有一个函数。
为了从我的cd中提取一些信息,我有一个可执行文件,我用
执行exec():
$ discOutput = exec(''。/ discid / dev / rdisk2'');
可执行文件在与php脚本所在的目录相同。当我在同一目录中从终端运行同一行时,它给了我
我想要的输出,php没有'''根本不给我任何输出。
在''ls'这样的基本函数上输出exec()确实会返回一个
值,所以该功能有效。我想不知怎的,我没有正确地指向discid可执行文件,但我没有看到错误。
有人可以告诉我我的意思吗我做错了吗?
先谢谢,Maarten
Howdy,
Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and
I have a little problem with one function within my cd-management script.
For extracting a bit of info from my cd''s I have an executable which I
execute with exec():
$discOutput = exec(''./discid /dev/rdisk2'');
The executable is in the same directory as the php script is in. When I
run the same line from Terminal within that same directory it gives me
the output I want, php doesn''t give me any ouput at all.
Asking exec() for output on a basic function like ''ls'' does return a
value, so the function is active. I guess somehow I am not pointing to
the discid executable correctly, but I don''t see what is wrong.
Can someone tell me what I am doing wrong?
Thanks in advance, Maarten
推荐答案
我确实无法肯定但我刚刚切换从Windows到Linux
并且在执行脚本时遇到了类似的问题...
尝试将包含文件夹添加到系统路径和/或使用
绝对路径而不是./&;无论如何,这解决了我的问题。
祝你好运:-)
Roger。
Well I cant say for sure but I''ve just switched from Windows to Linux
and had been having some similar problems execing scripts...
Try adding the containing folder to your system path and/or using
absolute path instead of "./" That fixed my problems anyway.
Good luck :-)
Roger.
这篇关于Exec()函数没有按我的意愿执行(OSX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!