John Davidson

how run bash script with php shell_exec with passing 2 variable parameter

0 comments
Message:


i want running bash script with passing 2 parameter and show with bash script create file.txt


$email = "omdik";
$password = "123";

$page = shell_exec("/var/www/html/aktiva-development/test.sh $email, $password");

and this file test.sh


#!/bin/bash
echo "username : $1 dan password : $2" > /tmp/cekhasil.txt

why the file not create, like the bash command is not running, but if script bash like ls dir the dir list will be show, and the access permision for file and folder i was change to 777


thank you for help.



My Answer:
$email = "example@example.com";
$param1 = "parameter1";
$param2 = "parameter2";

$output = shell_exec("bash script.sh $param1 $param2 $email");

echo $output;

Rate this post

4 of 5 based on 9810 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us