permissions with bash scripts in php?

From: Date: Mon, 12 Jan 2004 21:47:31 +0000
Subject: permissions with bash scripts in php?
Groups: php.general 
Request: Send a blank email to php-general+get-174380@lists.php.net to get a copy of this message
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

« previous php.general (#174380) next »