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 74 times
0
![](../../users/profiles/1256909.webp)
Rejoanul Alam
- 5,047
- 3
- 31
- 62
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
![](../../users/profiles/4126633.webp)
Daniel Krom
- 8,637
- 3
- 36
- 39
-
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.
![](../../users/profiles/5192785.webp)
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.
![](../../users/profiles/5169651.webp)
Sunitrams
- 2,186
- 2
- 11
- 27
-
`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. – Sunitrams Aug 05 '15 at 08:51
0
Hosting administrator may disabled some functions on the server for the security reason.
You may contact them
![](../../users/profiles/2681855.webp)
ManiMuthuPandi
- 1,448
- 1
- 19
- 37
-
-
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