----- Original Message ----- 
From: "Jas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 12, 2004 4:47 PM
Subject: [PHP] permissions with bash scripts in php?


> Something I have never tried... seems fairly straight-forward but I am
> running into problems.
>
> My problem is that I need to call system to restart a daemon service
> like so...
> <?php
> $cmd = "/path/to/shell/script/script.sh";
> system($cmd . " &> /tmp/error ");
> ?>
>
> Script contains this command...
> #!/bin/bash
> /path/to/dhcpd -cf /path/to/config/dhcpd
>
> So far so good right?  I mean it works from a command line so why not
> from php.  Lets check some permissions...
> httpd as Apache:Apache
> script.sh as Apache:Apache
>
> Upon inspection of 'error file' in /tmp I find this...
>
> unable to create icmp socket: Operation not permitted
> Can't create new lease file: Permission denied
>
> And...
>
> Can't bind to dhcp address: Permission denied
> Please make sure there is no other dhcp server
> running and that there's no entry for dhcp or
> bootp in /etc/inetd.conf.   Also make sure you
> are not running HP JetAdmin software, which
> includes a bootp server.
>
> So lets set a sticky bit on the script.sh and /path/to/config/dhcpd
> $> chmod 1777 /path/to/config/dhcpd
> $> chmod 1777 script.sh
>
> So far so good but I am still recieving the same error, if anyone has
> some good tips on what would be the most efficient & SECURE way of
> starting this service please point me to the tutorial.... Thanks a ton.
> Jas
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


is the apache user and group able to run the script from the command line? I
know under rh9, you have to be root to start / stop / restart just about all
the services.

Just an idea.

Jake

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

Reply via email to