如何在双环境中打印当前工作目录php版本

On a Linux server with multiple versions of php installed, I am looking for a simple command to show me the version of php being used for the current working directory through command line.

At first I tried simply using

php -v

but that apparently only shows the default php version for the server rather than the one set by .htaccess for the current directory.

Any help or a push in the right direction would be greatly appreciated.

One way is to add a php page in the current directory with the following in it.

< ?php phpinfo(); ?>

The browse to the page name which could be something like version.php and it will be displayed.

Also, I guess if you have access to the .htaccess file, you could always run a grep for the AddHandler, this will state what php version is being used for the directory the .htaccess file is in.

$ grep AddHandler .htaccess
AddHandler application/x-httpd-php54 .php

Otherwise, I know of no other command to do this without already knowing the php version and pointing to the correct php command in /bin. I hope this helps.