Hi everyone
I m lunux user and I have to use shell_exec from browser and i have made one script include shell_exec.Its wokring on shell but doesnot work from browser
So anybody can give me solution that what should i do for this.
Regrads,
shell_exec doesnot work from Browser
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
-
radicalfix
- Forum Newbie
- Posts: 7
- Joined: Mon Dec 04, 2006 10:49 pm
Re: shell_exec doesnot work from Browser
Haresh,
Where do you host the page? Is it from your localhost?
Try the code below and show us what is the result.
Can you tell us what is the error message you receive?
Where do you host the page? Is it from your localhost?
Try the code below and show us what is the result.
Code: Select all
<?php
$cmd = 'set';
echo "<pre>".shell_exec($cmd)."</pre>";
?>
Re: shell_exec doesnot work from Browser
Thanks for giving me reply
I run this scrpit on localhost and doesnt display on browser but on error log it display
"mkdir: cannot create directory `/root/Desktop/haresh123': Permission denied"
and my script is
<?php
shell_exec("mkdir /root/Desktop/haresh123");
?>
pls give me solution for that
I run this scrpit on localhost and doesnt display on browser but on error log it display
"mkdir: cannot create directory `/root/Desktop/haresh123': Permission denied"
and my script is
<?php
shell_exec("mkdir /root/Desktop/haresh123");
?>
pls give me solution for that
Re: shell_exec doesnot work from Browser
<?php
$cmd = 'set';
echo "<pre>".shell_exec($cmd)."</pre>";
?>
This php file give output is following
BASH=/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
BASH_VERSION='3.1.17(1)-release'
DIRSTACK=()
EUID=48
GROUPS=()
HOSTNAME=localhost.localdomain
HOSTTYPE=i686
IFS='
'
LANG=C
MACHTYPE=i686-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/usr/sbin:/bin:/usr/bin
POSIXLY_CORRECT=y
PPID=3036
PS4='+ '
PWD=/var/www/html
SHELL=/sbin/nologin
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=3
TERM=xterm
UID=48
_=/usr/sbin/httpd
$cmd = 'set';
echo "<pre>".shell_exec($cmd)."</pre>";
?>
This php file give output is following
BASH=/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
BASH_VERSION='3.1.17(1)-release'
DIRSTACK=()
EUID=48
GROUPS=()
HOSTNAME=localhost.localdomain
HOSTTYPE=i686
IFS='
'
LANG=C
MACHTYPE=i686-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/usr/sbin:/bin:/usr/bin
POSIXLY_CORRECT=y
PPID=3036
PS4='+ '
PWD=/var/www/html
SHELL=/sbin/nologin
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=3
TERM=xterm
UID=48
_=/usr/sbin/httpd