0

system(), exec() etc command works fine in windows (Windows+XAMPP) but when trying in live server (linux) all functions returns NULL. How can run those function from linux?

Rejoanul Alam
  • 5,047
  • 3
  • 31
  • 62

4 Answers4

0

I think that you are looking for shell_exec

shell_exec("/path/to");

edit: sometimes the problem is with escaping, wrap your arguments with escapeshellarg

Daniel Krom
  • 8,637
  • 3
  • 36
  • 39
0

Problem could be related with incorrect path or permission settings on Linux.

Murad Tagirov
  • 736
  • 6
  • 10
0

You can test this function in a php script to show the content of a folder:

<?php
    $output = shell_exec('ls -lart 2>&1');
    echo "<pre>$output</pre>";
?>

Notice this function is disabled when PHP is running in safe mode.

Sunitrams
  • 2,186
  • 2
  • 11
  • 27
0

Hosting administrator may disabled some functions on the server for the security reason.

You may contact them

ManiMuthuPandi
  • 1,448
  • 1
  • 19
  • 37