Re: [PHP] Re: I can't execute pf commands
If you want to execute shell commands as root theres another solution too try this: shell_exec('sudo -u root ls -l /var/tmp') but the solution Of shawn is better then it will not needed to set it again in another commands
Re: [PHP] Re: I can't execute pf commands
also by gcc you can use code it and run the gcc in shell I like this one: setfacl -m u:wwwrun:rw the path that you would like for permissions you can set it for the folders you have then run this compiler it will make an executable file you can give a name to them by -o 'r' and 'w' are for read and write also you can have 'x' for execute permission now you can use this executable file on any new computer just run it and it will make permissions I don't know in your Os you have wwwrun or not I have it in Suse *wwwrun is used for doing things permission-wise but Apache doesn't need to login with it. Again, this keeps it safe from attackers.* * * * *
[PHP] Re: I can't execute pf commands
On 07/28/2011 11:09 AM, Bulent Malik wrote: Hi I use php5.3 on freebsd I also use pf ( packet filter) on it. I need to execute pfctl in php script. But I couldn't execute . I don't get any errors about that. Shell commands is allowed in php.ini My My script is below, shell_exec('pfctl -s nat'); exec('pfctl -s nat'); If I execute another command like this ; it works shell_exec('ls -l /var/tmp') ; What can the problem be ? pfctl probably requires root privileges, so you can either set the suid on it or I would set it up in sudoers to allow the apache user to execute it without a password. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php