如何從 CLI 中查找 php 中內置模塊的版本號 (how to find the version numbers of built in modules in php from the CLI)


問題描述

如何從 CLI 中查找 php 中內置模塊的版本號 (how to find the version numbers of built in modules in php from the CLI)

Basically i am new to php, and i just installed php on my machine. so we can know entire information of the php configuration by creating a php file and writing the below code in it 

<?php 
  phpinfo();
?>

And i opened this through browser and can able to see all the configuration information

But is there any way to know the version of php default modules from linux terminal(I am using fedora by the way :) )

So what all i mean to ask is whether is there any way to find the version number of all the modules or individual modules from terminal through some php commands ?

For example there is a command php ‑me which displays all the php modules that comes by default when php is installed like below

[PHP modules]
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
shmop
....
.....

but in the same way i want to find the version number of the individual module too from the terminal, how can we find it ?

‑‑‑‑‑

參考解法

方法 1:

To see the version for one particular module, you can use the command php ‑‑ri <module> | grep Version.

For example:

php ‑‑ri mongo | grep Version 

Returns:

Version => 1.6.5

方法 2:

This should do the trick:

php ‑r 'foreach (get_loaded_extensions() as $extension) echo "$extension: " . phpversion($extension) . "\n";'

More readable version (for code usage):

$extensions = get_loaded_extensions();
foreach ($extensions as $extension) {
    echo "$extension: " . phpversion($extension) . "\n";
}

方法 3:

you want the phpversion() command if you want to do it inscript http://php.net/manual/en/function.phpversion.php

(by Shiva Krishna BavandlaWillGerald SchneiderDave)

參考文件

  1. how to find the version numbers of built in modules in php from the CLI (CC BY‑SA 3.0/4.0)

#module #Version #PHP






相關問題

如何在內核源文件中包含 math.h #include <math.h>? (How to include math.h #include <math.h> on kernel source file?)

根據服務器配置指令初始化 nginx 模塊的共享內存 (Initialize an nginx module's shared memory depending on a server configuration directive)

選擇安裝 python 模塊的位置 (Choosing where to install python module)

如何從 CLI 中查找 php 中內置模塊的版本號 (how to find the version numbers of built in modules in php from the CLI)

java.lang.SecurityException:無法為受信任的 CA (JBoss AS 7) 設置證書 (java.lang.SecurityException: Cannot set up certs for trusted CAs (JBoss AS 7))

自定義 AngularJS 過濾器忽略我的參數並接收其他一些 scope.data (custom AngularJS filter ignores my parameter and receive some other scope.data)

具有“插件”能力的 ASP.NET 內網應用程序 (ASP.NET intranet application with "plug-in" ability)

VBscript 有模塊嗎?我需要處理 CSV (Does VBscript have modules? I need to handle CSV)

自定義 Mage_Sales_Model_Quote_Address_Total_Abstract 計算兩次:帳單和送貨地址 (Custom Mage_Sales_Model_Quote_Address_Total_Abstract calculate twice: billing&shipping address)

Ocaml 函子、模塊和子模塊 (Ocaml Functors, Modules and Submodules)

類的 Python 模塊結構 (Python module structure for classes)

我想使用 HPC 的 gpu 並嘗試 module add CUDA ...但出現錯誤。錯誤是“Lmod 檢測到以下錯誤: (I want to use the gpu of the HPC and try module add CUDA... But errors occurs. The error is "Lmod has detected the following error:)







留言討論