Example 1 — Check the PHP Program
PHP_BINARY holds the path of the PHP program that runs your script, so it is a safe file to test.
<?php
if (is_executable(PHP_BINARY)) {
echo "PHP binary is executable", PHP_EOL;
} else {
echo "PHP binary is not executable", PHP_EOL;
} How It Works
- PHP_BINARY is a built-in constant with the full path of the PHP program.
- is_executable() checks that the file exists and can be run.
- The result is true, so the first message is printed.
- Some setups such as php-fpm may leave PHP_BINARY empty, and then the check returns false.

