Ponting Ponting - 1 year ago 111
PHP Question

How to get path of the php binary on server where it is located

I am using exec command as below in PHP :

exec("/usr/bin/php /path/to/Notification.php >> /path/to/log_file.log 2>&1 &");

In local environment(MAMP),I know the php installation path so I can replace
. But I dont know where php installation(php binary) is located on production server?

Answer Source

It's usually /usr/bin/php but you could try to capture and parse the output of the command 'whereis php'.

Or better yet, use the constant PHP_BINARY. Have a look here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download