用linux从php运行外部命令

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?

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

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

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.

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

You may contact them