Should external programs called by exec() in PHP be PHP files or files on the server?

When using the exec() function in PHP to call external programs, the programs being called can be PHP files or any other type of executable file on the server. It ultimately depends on what the external program is meant to do and how it is designed. If the external program needs to interact with PHP data or functions, it may be beneficial to have it as a PHP file. Otherwise, any executable file can be called using exec().

// Example of calling an external program that is a PHP file
exec('php /path/to/external_program.php');

// Example of calling an external program that is not a PHP file
exec('/path/to/external_program');