Introduction
Introduction –
Introduction to File_Fstab.
Overview
This package allows you to read, manipulate, and write fstab-format files, such as /etc/fstab, /etc/mtab, and /proc/mounts.
Examples
Getting the filesystem type of the root device.
<?php
require_once 'File/Fstab.php';
$fstab =& new File_Fstab();
$root =& $fstab->getEntryForPath('/');
echo "Root FS type: " . $root->fsType . "\n";
?>
Determine if a user may mount the CD-ROM
The user
option in your fstab determines whether
users may mount a given device or not.
<?php
require_once 'File/Fstab.php';
$fstab =& new File_Fstab();
$cd =& $fstab->getEntryForDevice('/dev/cdrom');
if ($cd->hasOption('user')) {
echo "Users may mount the CD-ROM\n";
} else {
echo "Users may not mount the CD-ROM\n";
}
?>