A
A
Alexander2020-01-04 13:17:53
linux
Alexander, 2020-01-04 13:17:53

How to execute command in php terminal on FreeBSD?

Need to run command

sox media/60847/intro.wav -r 8000 -c 1 media/60847/intro.gsm

Tried through exec, nothing happens, as I understand it because of the rights (whoami issues the www user). How to run a command as a different user?
Googled through sudo, is it possible to do without installing it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2020-01-04
@FanatPHP

I understand because of the rights

The most important thing to understand about programming is that you should never understand .
And you always have to know for sure .
And even more so, you don’t have to start rushing about and make chaotic gestures, such as installing sudo, prescribing paths, and other things, based only on understanding .
If something goes wrong, the system always informs you about it . And you just need to take this message and read it. And then fix the specific error .
Instead of the inconvenient exec, we use the normal shell_exec().
to see errors, add at the end of the command2>&1
out will contain console output, including errors.
Read the error and correct

R
Ruslan Fedoseev, 2020-01-04
@martin74ua

what about the user?
try the full paths to the files, to the command...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question