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 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体