LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 05-19-2012, 12:23 PM   #16
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55

Quote:
Originally Posted by jeethapj View Post
Ok sir.I have tried as "apache ALL = NOPASSWD: /etc/init.d/network restart",
"httpd ALL = NOPASSWD: /etc/init.d/network restart"..

When I checked "whoami" it is giving the result as "asterisk"..Then I tried also
"asterisk ALL = NOPASSWD: /etc/init.d/network restart"..

Then I run the script
<? php

System('sudo /etc/init.d/network restart',$result);
echo "$result";
?>

Then nothing is happening and it is displaying the result 1.
Also when I tried
<? php

System('service network restart',$result);
echo "$result";
?>

It is returning the result as 0 and also displaying


Shutting down interface eth0: [FAILED] Shutting down loopback interface: [FAILED] Bringing up loopback interface: [FAILED] Bringing up interface eth0: [FAILED]

here are the step which you need to follow;

1) Comment a option into of "Default requiretty" using visudo

Code:
cat /etc/sudoers  | egrep "requiretty|apache"
#Defaults    requiretty
apache ALL=NOPASSWD: /etc/init.d/network restart
2) your php code

Code:
<?php

   system('sudo /etc/init.d/network restart',$result);
   echo "$result";
?>
it must work.
 
Old 08-03-2012, 02:51 AM   #17
jeethapj
LQ Newbie
 
Registered: May 2012
Posts: 17

Original Poster
Rep: Reputation: Disabled
Please anyone help me to run the command "service network restart" through GUI..When I directly run the command in command prompt it is working.But through GUI it is not..The command is executing but it is showing

"Shutting down interface eth0: [FAILED] Shutting down loopback interface: [FAILED] Bringing up loopback interface: [FAILED] Bringing up interface eth0: [FAILED]"

I am the root user.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't run PHP script on Linux virtual server shanekelly Linux - Newbie 9 06-10-2011 09:36 AM
SAN errors while rebooting LINUX server sjarade Linux - Newbie 2 06-26-2009 11:09 AM
PHP Login script working on windows server but not on Linux Red Hat Server ahmedyk Linux - Newbie 2 01-14-2009 12:22 AM
Red Hat Linux 8.0 on IBM server is rebooting hemanth_13 Linux - General 5 12-16-2003 10:15 AM


All times are GMT -5. The time now is 06:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration