Breed Hansen
Breed Hansen

Reputation: 1179

How to use bash script from PHP?

İ know this question is widely asked but I still can't do this. I have a working bash script. I used the shell_exec() method. I tried all cases: bash script and php file were in the same directory. Bash script were in home directory. I am using PHP 5.4 so, it can't from "safe_mode" error.

Any idea?

/**
 * @Route("/ftp")
 * @Template()
 */
public function ftpAction(){

    $output = shell_exec('sh ./test.sh');

    var_dump($output);

    return new Response('ftp :'.$output);
}

Upvotes: 0

Views: 284

Answers (1)

Breed Hansen
Breed Hansen

Reputation: 1179

I found the solution. (https://serverfault.com/questions/272551/how-do-you-give-execute-permissions-to-apache2-user-and-not-to-everyone-else)

Sorry for that. Thanks for your help.

Upvotes: 1

Related Questions