0

i am executing script file through php as

shell_exec(sh script.sh)

script.sh is the name of the script file. This script is used to transferring file say 'abc' to remote machine. When I execute script file through terminal as

./script.sh

it successfully transfer file to remote machine but when execute same script file through php it could not transfer file to remote.Any suggestions are welcome...

Ranjit Singh
  • 311
  • 1
  • 4
  • 13

1 Answers1

1

When you execute it in the shell you are using your user credentials.

When running from withih a PHP script script you are using apache user or group credentials.

Make sure apache can run your script

check here Executing a Bash script from a PHP script

Community
  • 1
  • 1
Julio Soares
  • 1,200
  • 8
  • 11