473,811 Members | 2,982 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can i restart httpd from a php script?

anr
Hi everyone,

I have made a solution where a user is added to the system and a folder
is set up for him. In order to make the folder webDAV accessible for
him I have to add some lines to the current httpd.conf file and restart
the webserver. Is this possible to do from my php script - or even
advisable?

I could envision an alternative where i would make a cron job restart
httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?

anr

Jul 17 '05 #1
5 3226
*** an*@mac.com wrote/escribió (13 Aug 2004 02:22:45 -0700):
I have made a solution where a user is added to the system and a folder
is set up for him. In order to make the folder webDAV accessible for
him I have to add some lines to the current httpd.conf file and restart
the webserver. Is this possible to do from my php script - or even
advisable?


An idea I can think of is using sudo. Edit /etc/sudoers width 'visudo'
command and give 'apache' user the right to execute only what you need:

apache localhost=/etc/rc.d/init.d/httpd reload

I've never used it myself so you're advised to read manual first.
--
-- Álvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #2
an*@mac.com wrote:
Hi everyone,

I have made a solution where a user is added to the system and a
folder is set up for him. In order to make the folder webDAV
accessible for him I have to add some lines to the current httpd.conf
file and restart the webserver. Is this possible to do from my php
script - or even advisable?

I could envision an alternative where i would make a cron job restart
httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?

anr


If you ask me, that is asking for trouble. What happens with the connection
that user has to your server during a restart ? Besides, you would have to
give Nobody executable access to httpd.
Why not have PHP create a flag file somewhere and have a cron shell script
check for the flag file, then act upon its existence and remove it? (If
there is no other ay of course of telling apache to accept new WEBdav
settings.

HTH
Pjotr
Jul 17 '05 #3
an*@mac.com wrote:
Hi everyone,

I have made a solution where a user is added to the system and a folder
is set up for him. In order to make the folder webDAV accessible for
him I have to add some lines to the current httpd.conf file and restart
the webserver. Is this possible to do from my php script - or even
advisable?

I could envision an alternative where i would make a cron job restart
httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?

anr


Hi,

direct:
- Giving nobody (or whoever runs as apache) rights to restart Apache.
This means that nobody can do a sudo.
I think that is bad.

indirect:
You could write a 'signal-file' as user nobody in some special directory and
let some cronjob check for that file every hour or so.
If it is found --> restart Apache and delete the file.

Of course this is not instant, but safer than giving nobody rights.

Maybe there is a better solution (sticky bit????), but I am too nOOb on *nix
to think of it. :-)

Regards,
Erwin Moller
Jul 17 '05 #4
"anr" wrote:
Hi everyone,

I have made a solution where a user is added to the system and a
folder
is set up for him. In order to make the folder webDAV accessible for him I have to add some lines to the current httpd.conf file and
restart
the webserver. Is this possible to do from my php script - or even
advisable?

I could envision an alternative where i would make a cron job restart httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?

anr


DONT DO THAT. I think I have a flash of brilliance (happens once
every 10 years or so).

Set up lots of folders, and then assign them to new users as they come
in. This way, you don’t have to reboot anything.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-restart-...ict139383.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=467188
Jul 17 '05 #5
On Fri, 13 Aug 2004 02:22:45 -0700, anr wrote:
I have made a solution where a user is added to the system and a folder
is set up for him. In order to make the folder webDAV accessible for
him I have to add some lines to the current httpd.conf file and restart
the webserver. Is this possible to do from my php script - or even
advisable?

I could envision an alternative where i would make a cron job restart
httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?


Of course it is possible! Make a little C program which will contain the
following sequence of commands:

/*
The definition of INIT depends on your OS. It may be /etc/init or
even /bin/init.
*/
#define INIT "/sbin/init 6"
#define ROOT 0
setuid((uid_t) ROOT);
system(INIT);

Then make that program setuid root (chown root prog; chmod 4755 prog)
and put in the path visible by PHP scripts. All you need is to execute
the program using "system" from a PHP script. As per that being advisable,
any manual or article about the computer security will tell you exactly
how advisable is that.
--
A city is a large community where people are lonesome together.

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2175
by: Solange Ezveff | last post by:
Hi, Trying to restart MySQL when it is down. I have placed the following script in a file : checksql ---> #!/bin/sh /etc/rc.d/init.d/mysqld status >/dev/null 2>&1
6
3567
by: black francis | last post by:
hello all, i`m trying to restart apache from php but have failed completely. has anyone sucesfully done it? i'm currently able to execute other unix commands from php adding the proper permissions to the sudo file but apache refuses to restart. here's the pseudo-script:
1
2244
by: Piotr Trawiñski | last post by:
I have this notorious problem: at some point pgsql simply hangs up and requires a restart. --------------------------------------------------------------------------- ------- homer:/usr/share/doc/postgresql-contrib# /etc/init.d/postgresql restart Restarting PostgreSQL database: postmaster Stopped /usr/lib/postgresql/bin/postmaster (pid 14243 14245 14247 14750 14811 1489 15569 15570 15573 15584 15643 15644 15665 15800 15801 15804 15817...
8
3047
by: firas489 | last post by:
Sometimes i need to restart the IIS on a current server, but the problems is that if i want to, then i have to contact them by either email or phone, but sometimes it takes few hour to do it. So i wonder if there Is a way to restart your IIS Programmitcally?? Thanx in adavnce Best Regards Firas S Assaad
8
6311
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache/include So then I run this command: find / -name httpd.h
1
2960
by: drhopscotch | last post by:
Hi, I was getting Out of Memory PHP fatal errors on my Apache 2.2.4 server on WinXP and narrowed things down to discover that httpd process memory is not released after a PHP script is requested (even the very most basic script: <?php ?). The httpd memory usage increases approximately 520k after every request (if the request occurs after the KeepAliveTimeout period. I imagine that there must be a straightforward reason for this, but I
0
1377
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I know the name of AppPool in an web server (Win 2003 server) and I want restart AppPool by code or script. Does anyone know how to restart (or recycle) a web application pool (AppPool)in IIS with C# code AND/OR script VBS (WSH) AND/OR BAT file in IIS 6.0 / IIS 7.0 ? Any help will be very grateful ??
12
5985
by: Kevin Blount | last post by:
I'm trying to create the forum favorite dynamic sig image, that's realy PHP script. I've had moderate success with .php files but when I change the extension to .png I'm prompted to download the file, rather than it rendering. My understanding is that this is not supposed to happen, and that by adding an.htaccess file I can force .png files to be compiled/parsed/ whatevered by PHP. In my .htaccess file I have: AddType...
1
2714
by: symbioid | last post by:
Hello, I'm working on a project, and VMware has problems with suspending the virtual machine. We are accessing the machine through samba. However, when I suspend the VM, it stops the Samba service. The solution we hit upon was to run a script that checks, say, once a minute to determine whether the machine was active or suspended. If it's been longer than a minute, we restart the samba service.
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3876
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.