[PHP] Re: Doing system things with PHP

2002-08-25 Thread Eric Pignot

Hi !

there is no way to apply a config file to apache without restarting the
webserver
the only way I know (which really does not mean that it is the only one !),
is to use the command "apachctl" or "httpd". But those command need to be
launched as root, I think (try to login as root, then to a "su nobody", and
try to launch apache like this. If it works, then a simple exec("apachctl
restart") should be enough, check the syntax of exec() there :
http://www.php.net/exec ).

If you need to be root to start apache, then you'll need to either build a
script that changes user to root, and lauches "apachectl restart" once
logged ( try the "sudo" command in your shell, it is available in any linux
distribution, or try freshmeat.net ),  or use the setuid bit so that any
user can start httpd with root provilege (which would work but wouldn't be
recommende. "man chmod" to know more about this).

regards

Eric



"Liam Mackenzie" <[EMAIL PROTECTED]> a écrit dans le message de
news: 008f01c24c98$895404c0$[EMAIL PROTECTED]
> Hey all,
>
> I need to restart apache using PHP.  Is this possible?
> Or, ar least apply a modified config file...
>
> PHP is running as nobody:nobody as is Apache.
>
> Thanks,
> Liam
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Doing system things with PHP

2002-08-25 Thread Chris Shiflett

Yes, you can make Apache reload a config file without restarting. You 
must send it a SIGHUP:

kill -HUP `cat /var/run/httpd.pid`

If you execute this as nobody, I believe it will work, but I haven't 
tested it.

Also, I believe Apache will restart when given a "kill -1". If the above 
suggestions works, so will this.

Happy hacking.

Chris

Eric Pignot wrote:

>there is no way to apply a config file to apache without restarting the
>webserver
>
>"Liam Mackenzie" <[EMAIL PROTECTED]> a écrit dans le message de
>news: 008f01c24c98$895404c0$[EMAIL PROTECTED]
>  
>
>>I need to restart apache using PHP.  Is this possible?
>>Or, ar least apply a modified config file...
>>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Doing system things with PHP

2002-08-26 Thread Eric Pignot

> kill -HUP `cat /var/run/httpd.pid`

>

> If you execute this as nobody, I believe it will work, but I haven't

> tested it.

nope, it won't, as you need to be the owner to send a signal to a process.

regards.

Eric




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Doing system things with PHP

2002-08-26 Thread David T-G

Eric, et al --

...and then Eric Pignot said...
% 
% > kill -HUP `cat /var/run/httpd.pid`
% >
% > If you execute this as nobody, I believe it will work, but I haven't
% > tested it.
% 
% nope, it won't, as you need to be the owner to send a signal to a process.

And if the web server is running as nobody, as it probably should be,
then... ?


% 
% regards.
% 
% Eric


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg76687/pgp0.pgp
Description: PGP signature