0

Here in my php file, I'm trying to execute a shell command. I was able to run the command variable value in the terminal just fine. But somehow shell_exec doesn't do it for me.

$command = 'jpegoptim '.$imgpath;
shell_exec($command);

Look like 'git status' won't even work in here

$output = shell_exec('git status');

Update: finally getting an error

sh: jpegoptim: command not found

user2700690
  • 563
  • 3
  • 11
  • 25

1 Answers1

2

You have to install jpegoptim on your server. After this you can use the shell_exec("jpegoptim") command.

apt-get install jpegoptim

Vmadmax
  • 94
  • 3
  • 8