- Can php actually executes shell scripts in the first place?
And ya RedHead, i tried to execute the iptables commands from apache i.e instead of "iptables -L" i type "iptables -A INPUT -i lo -j ACCEPT" and then going to the command line to check and it does not execute it. Am i wrong, omg i realli have no idea on how to do,
and it dun seems to have any links to the command line although specifying the shell_exec().
Plaese check if PHP is running in safemode, shell_exec() is one of the functions that are restricted when PHP is in safemode.
You should atleast get something out of it, and yes shell_exec() returns a string which can be used in as an "echo .." argument, or print_r() if you want to make sure it's not because the return is of some obscure return type.
You could as a test addto see what it's initialy set as, if it returns "1", then PHP is in safemode.Code:echo ini_get('safe_mode');
Or perhaps it has something todo with apache not knowing where iptables resides, so you could make itCode:shell_exec("/sbin/iptables -L");
Don't worry Ma'am. We're university students, - We know what We're doing.
'Ruiat coelum, fiat voluntas tua.'Datalogi - en livsstil; Intet liv, ingen stil.
Yah redhead i did wat u told mi i wasn't able to see the result of echo ini_get('safe_mode'); either in the command line or on the apache.
and strange thing is i can get iptables command to run in the terminal and not apache i believe when interfacing with command line, something is missing, i believe it is not executed.
I tried normal commands like "ls -al" is able to work perfectly, but when come to iptables on apache it does not show the result, strange didn't know where went wrong.
i tried executing "iptables -L" in the command line, it works but when i access it from the web, it does not show anithing and when i write simple check to check whether the variable is "", it return the the string is empty. ??
Anyone knows how to execute shell scripts from apache?
Having problem here, or is the concept wrong in the first place.
Yes, backticks work for me with PHP. (Same thing as shell_exec).
I'd check permissions on iptables... it's normally in sbin, which shouldn't be in the PATH of the apache user
63,000 bugs in the code, 63,000 bugs,
ya get 1 whacked with a service pack,
now there's 63,005 bugs in the code!!