Rohullah Rajaee Rad
Rohullah Rajaee Rad

Reputation: 581

Run shell_exec Function in PHP Not Work

run "mumudvb -l" command in the linux terminal has correct output. but in php the output is nothing.like this:

$output = exec('mumudvb -l');

$output = shell_exec('mumudvb -l');

 $output = "" //the output

why this happen?

Upvotes: 0

Views: 1068

Answers (2)

Jesse Schokker
Jesse Schokker

Reputation: 896

On Linux machines, setting that certain value in php.ini does not always work.

What I did was add the following sudoers group: %admin ALL=NOPASSWD: ALL then make the www-data user run as admin usermod -G admin www-data next, all the commands that you use with shell_exec, prefix them with sudo.

Upvotes: 0

Pham Lai
Pham Lai

Reputation: 151

You cannot use this function because php.ini know it's disabled functions in config file

+Solution: Open your php.ini, find disable_functions and remove your function then restart web server. BTW, becareful because security problem you may have. You should improve your server security

Upvotes: 1

Related Questions