Ranjit Singh
Ranjit Singh

Reputation: 331

issue in transfer file to remote machine on executing shell script through php

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...

Upvotes: 0

Views: 44

Answers (1)

Julio Soares
Julio Soares

Reputation: 1190

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

Upvotes: 1

Related Questions