dragon201401 2016-02-26 06:57
浏览 43
已采纳

如何在双环境中打印当前工作目录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.

  • 写回答

1条回答 默认 最新

  • dongyi1996 2016-02-26 07:10
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?