0
<?php
$out = array();
$execute='./test.py';
$name="test";
exec("$execute $name",$out);
foreach ($out as $value) {
    echo "$value<br />\n";
}
?>

when I executing above code in local server its working..

But in hosted server, exec () function doesn't take the parameter variable '$name'.

why?

2
Contributors
8
Replies
10
Views
6 Years
Discussion Span
Last Post by benqb
0

There are a lot of shared hosting providers that block the use of exec() as it can be a possible security risk when using shared hosting. You should check with your hosting provider to make sure that this command is available to use on your hosting plan.

Two others commonly blocked are:
system()
shell_exec()

0

There are a lot of shared hosting providers that block the use of exec() as it can be a possible security risk when using shared hosting. You should check with your hosting provider to make sure that this command is available to use on your hosting plan.

Two others commonly blocked are:
system()
shell_exec()

In my hosted server exec() function is working but it cannot takes the parameter '$name'

0

What type of error does PHP output when the code is run?

There is no error ,parameter value is not getting in the 'test.py' page

so no output.

0

Just out of curiosity, what happens when you replace your exec() command with this one?

exec('./test.py test',$out);
0

Just out of curiosity, what happens when you replace your exec() command with this one?

exec('./test.py test',$out);

Same error

0

Are you able to SSH into the server and run the script manually? Making sure that you can execute Python scripts on your server?

0

Are you able to SSH into the server and run the script manually? Making sure that you can execute Python scripts on your server?

Python script is correctly working...
Its the problem with exec() function

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.