PHP CLI Bad Interpreter: Permission Denied

This question came up on the php.general list today. And i have seen it before when writing an shell script in PHP.

#!/usr/local/bin/php
passthru("printenv");

If you are sure the PHP executable can be found in that location. And the file is executable. But it still returns this error:

/usr/local/bin/php: bad interpreter: Permission denied

Big change the file you are trying to execute is on a filesystem with the noexec flag set. To fix this either set the exec flag for the filesystem or move the script to a place where it can be executed.

comments powered by Disqus