Hi,

Im working on a PHP script in which I have to run shell script,

I have 2 option ,

  1. If im able to send php veriable value to shell
  2. Or i can write shell directly in PHP

I used

shell_exec(dirname(__FILE__) ."/shl.sh");

for execute shell .... Now the problem is .. if i use #!/usr/bin/php in shell it only resolve code within <?php ?>
and print shell statment directly on screen ..

So I need a Urgent Help ...

Please Help Me Out ...

shell_exec() states that

Execute command via shell and return the complete output as a string

That means that the output should be returned as a string. Are you sure the program you are executing isn't printing anything to the screen? Note sure if that's even possible, I don't use this function very often. Just trying to help ^^. Maybe you can use something like $result = shell_exec(...);?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.