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?
Asked
Active
Viewed 104 times
0

Rejoanul Alam
- 5,435
- 3
- 39
- 68
4 Answers
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
-
what is the path for `shell_exec('ipconfig/all');` this command? – Rejoanul Alam Aug 05 '15 at 08:49
-
ipconfig is for windows, linux is different world: http://askubuntu.com/questions/79000/what-is-the-equivalent-terminal-command-to-ipconfig-all – Daniel Krom Aug 05 '15 at 08:50
-
So how can i find MAC address for client computer? – Rejoanul Alam Aug 05 '15 at 08:51
-
http://stackoverflow.com/questions/1420381/how-can-i-get-the-mac-and-the-ip-address-of-a-connected-client-in-php – Daniel Krom Aug 05 '15 at 08:54
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
-
`string(44) "sh: ipconfig/all: No such file or directory " ` showing this error – Rejoanul Alam Aug 05 '15 at 08:48
-
If you are on linux the command "ipconfig/all" doesn't work it is "ifconfig" instead ! You can do a man ifconfig for further information. – Sylvain Martin Aug 05 '15 at 08:51
0
Hosting administrator may disabled some functions on the server for the security reason.
You may contact them

ManiMuthuPandi
- 1,594
- 2
- 26
- 46
-
-
Go to php.ini configuration and search with keyword "disable_functions". You might see disable_functions=exec,system,passthru,.. Remove the required names from this. – ManiMuthuPandi Aug 05 '15 at 09:40