r r
r r

Reputation: 40

php exec not working properly on remote server

php functions like exec and shell_exec work fine on localhost but it doesn't work properly on remote host.

$output = shell_exec('dir');

echo "<pre>$output</pre>";

This code gives output in localhost but not at remote server. Any Clue?

Upvotes: 0

Views: 637

Answers (3)

Jan.
Jan.

Reputation: 1995

Take a look at http://php.net/glob or http://php.net/manual/en/class.directoryiterator.php Executing dir or ls makes no sense at all, to me.

Upvotes: 0

xdazz
xdazz

Reputation: 160943

dir command is in windows system, so is your remote server a windows server too?

Even it is a windows server, the configure may be different from your local machine that disables shell_exec

Upvotes: 1

DayS
DayS

Reputation: 1561

This kind of php commands are usually disabled on remote web servers. If you really want them to works, you should use a dedicated server and configure it yourself.

Upvotes: 1

Related Questions