How to get the version of a PHP Extension

This forum covers all minor versions of PHP 7
Post Reply
User avatar
Administrator
Site Admin
Posts: 1725
Joined: Thu Mar 22, 2018 10:19 am

How to get the version of a PHP Extension

Post by Administrator » Thu Dec 27, 2018 2:04 am

You can use the terminal or a ExtensionReflection Class Instance

Method 1 - With a Script

Code: Select all

// Create an instance of the ReflectionExtension class
$ext= new ReflectionExtension('ssh2');

// Print out basic information
$version =  $ext->getVersion() ? $ext->getVersion() : 'NO_VERSION',

var_dump($version);
more information on the ExtensionReflection class http://php.net/manual/en/class.reflectionextension.php

Method 2 - Using the terminal

Code: Select all

php --ri ssh2
Where "ssh2" string literal is the install extension in question.

Post Reply