hi to all,
i am running php 4.3 on fedora core 1 in my script i am trying to execute some linux commands such as service vsftp stop . i am using backtick operator, shell_exec,exec commands but still the service is not stopping when i check it from console. i am executing the script not with root user but with a user in which the uid value is 0 i.e i am also included in root,apache and ftp groups.
can someone help me to solve this problem i am in very urgent need to solve this problem.
waiting for a reply from the form.
thanks..
tushar akolkar.
problems in executing linux commands from php
Moderator: General Moderators
-
tushar_akolkar
- Forum Newbie
- Posts: 2
- Joined: Thu Apr 15, 2004 8:46 am
-
penguinboy
- Forum Contributor
- Posts: 171
- Joined: Thu Nov 07, 2002 11:25 am
-
tushar_akolkar
- Forum Newbie
- Posts: 2
- Joined: Thu Apr 15, 2004 8:46 am
here's the code in which getting problem
hi to all,
thanx for your reply i am posting here the code in which i am getting error.
<?php
$status = `service vsftpd status 2>&1 1>/dev/null`;
$result = `service vsftpd stop 2>&1 1>/dev/null`;
system('service vsftpd status');
system('service vsftpd stop');
if(strcmp(trim($status),"" == 0))
echo "<BR>vsftpd is running....";
else
echo "<BR>Error....";
if(strcmp(trim($result),"" == 0))
echo "<BR>service vsftpd stopped successfull...";
else
echo "<BR>Error .....";
?>
after running this script i am getting output as follows:
vsftpd (pid 1805) is running... Shutting down vsftpd: [FAILED]
vsftpd is running....
service vsftpd stopped successfull...
well i still want to add one thing that i am running php module under apache so does it makes any effect for executing linux commands from php and well most other commands like mkdir, ls, etc. r running from my php script but well the problem above is still unsolved and i want to implement this thing. if this is not possible this way then is there any other way to solve the problem . pls help me its urgent......
i hope my problem is now quite clear with u....
plese do the need ful.
waiting for a reply from u....
tushar akolkar
thanx for your reply i am posting here the code in which i am getting error.
<?php
$status = `service vsftpd status 2>&1 1>/dev/null`;
$result = `service vsftpd stop 2>&1 1>/dev/null`;
system('service vsftpd status');
system('service vsftpd stop');
if(strcmp(trim($status),"" == 0))
echo "<BR>vsftpd is running....";
else
echo "<BR>Error....";
if(strcmp(trim($result),"" == 0))
echo "<BR>service vsftpd stopped successfull...";
else
echo "<BR>Error .....";
?>
after running this script i am getting output as follows:
vsftpd (pid 1805) is running... Shutting down vsftpd: [FAILED]
vsftpd is running....
service vsftpd stopped successfull...
well i still want to add one thing that i am running php module under apache so does it makes any effect for executing linux commands from php and well most other commands like mkdir, ls, etc. r running from my php script but well the problem above is still unsolved and i want to implement this thing. if this is not possible this way then is there any other way to solve the problem . pls help me its urgent......
i hope my problem is now quite clear with u....
plese do the need ful.
waiting for a reply from u....
tushar akolkar