Reply to Re: Reboot Linux Service with PHP

Your name:

Reply:


Posted by theGerm on 03/29/07 17:15

On Mar 29, 11:34 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
> theGerm wrote:
> > Is it possible for me to restart a service with PHP? I need to run
> > this from a webpage
>
> > /sbin/service squid reload
>
> You can run that using PHP's system() function:
>
> <?php system("/sbin/service squid reload"); ?>
>
> However, normally "/sbin/service X" is just a shortcut to running
> "/etc/init.d/X" and if you take a look at the permissions for the contents
> of the "/etc/init.d/" directory, they'll mostly be only executable by
> root. (And the web server doesn't run as root!)
>
> So the initial reaction is to just change the permissions on
> "/etc/init.d/squid" to allow non-root users to run it. That won't work
> though.
>
> What you'd need to do is use "sudo" to allow whatever user Apache runs
> under (normally the user is called "httpd", "apache" or "nobody") to be
> able to run "/etc/init.d/squid".
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~http://tobyinkster.co.uk/contact
> Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
>
> * = I'm getting there!

I have this

<?php system("sudo /etc/init.d/squid reload 2>&1"); ?>

on that page I just see text - Password:

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация