Check for module existence and version
In case you need check the existence of a given PHP module/extension, the following one-liner comes in handy and no old-skool phpinfo()
look-up is needed.
Check for existing module:
$ php -m | grep xdebug | wc -l
1
Check for non-existing module:
$ php -m | grep mongo | wc -l
0
In case you need some more detailed info (e.g. version number) about an existing module you can issue php --ri <module-name>
and will get the desired info.
$ php --ri json
json
json support => enabled
json version => 1.2.1
Written by Raphael Stolt
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#