Home >Backend Development >PHP Tutorial >php is_executable Determine whether a file is an executable file_PHP tutorial
php is_executable determines whether the file is an executable file
is_executable
(PHP 4, PHP 5)
is_executable - tells whether the file name is executable
Description
boolean is_executable (string $filename)
Tells whether filename is an executable file.
Parameters
File name
File path.
Return value
Returns TRUE if the file exists and is executable, or FALSE on error.
Modify
Release Notes
5.0.0 is_executable() becomes available with Windows
Example
Example #1 is_executable() example
$file = '/home/vincent/somefile.sh';
if (is_executable($file)) {
echo $file.' is executable';
} else {
echo $file.' is not executable';
}
?>