Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the path of the PHP binary from PHP?

Tags:

How can I get the binary path of php from PHP?

I saw it in phpinfo(), but I need another method that gets it in Linux and Windows systems.

like image 230
Wiliam Avatar asked Oct 08 '10 09:10

Wiliam


People also ask

Where is PHP binary path?

The cPanel-provided PHP binary exists on the system as one of the following files: /usr/local/cpanel/3rdparty/bin/php. /usr/local/cpanel/3rdparty/bin/php-cgi.

Where is my PHP path Linux?

Use phpinfo() Function To Get PHP Version & PHP Install Path. The phpinfo() function can return a lot of useful information ( includes PHP Version and Install Path ) about currently used PHP.


1 Answers

You can use:

$_SERVER['_'] 

Also, the predefined constant PHP_BINDIR gives the directory where the PHP executable is found.

Sample on CodePad and Ideone.

It looks like, for security reasons, $_SERVER values are not exposed.

like image 176
codaddict Avatar answered Dec 01 '22 20:12

codaddict