setting sudoer

setting file sudoer di ubuntu supaya apche bisa mengeksekusi file, atau dengan kata lain script php bisa mengeksekusi binary

1. sudo su , masukan passwordnya

2. gedit /etc/sudoer

3. tambahkan di baris terahir sintak berikut
www-data ALL=(ALL) NOPASSWD:ALL

berikut contoh eksekusi lire dari script php :

<?php

$format_output =”xml”;
$format_type =”syslog”;
$source_file =”/var/log/syslog”;
$destination_file =”/home/”;

$sintak=”sudo lr_log2report –output “.$format_output.” “.$format_type.” “.$source_file.” “.$destination_file.” “;

$perl_out = shell_exec($sintak);

?>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s