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,435
  • 3
  • 39
  • 68

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
  • 9,751
  • 3
  • 43
  • 44
0

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

Murad Tagirov
  • 776
  • 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.

Sylvain Martin
  • 2,365
  • 3
  • 14
  • 29
0

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

You may contact them

ManiMuthuPandi
  • 1,594
  • 2
  • 26
  • 46