How to get path of the php binary on server where it is located
问题 I am using the exec command as below in PHP : exec("/usr/bin/php /path/to/Notification.php >> /path/to/log_file.log 2>&1 &"); In my local environment (MAMP), I know the PHP installation path, so I can replace /usr/bin/php with /Applications/MAMP/bin/php/php5.4.10/bin/php . But I don't know where the PHP installation (PHP binary) is located on the production server. 回答1: It's usually /usr/bin/php but you could try to capture and parse the output of the command ' whereis php ' or ' which php' '