How to check active PHP extension
Hello everyone,
In order to run a custom plugin, I need to make sure that dom and json php extensions are enabled. I searched online on how to do that, but my cPanel is different (vps hosting) and doesn't have the same options (instead of Select PHP Version, I have MultiPHP Manager which doesn't show the enabled extensions).
Thanks for your help guys.
-
You could try this: In your /public_html folder, create a file called eg showext.php and then add the following content[php] "; print_r(get_loaded_extensions()); echo ""; ?> [/php] Now call the file in a web browser and you should get a list of all the loaded extensions 0 -
Hi @Killy89 You can also do this from CLI if you have that available. Log in as your user, and run the following: For the native/default version: [lauren@server test]$ php -m |egrep 'dom|json' dom json
for a specific PHP version (in my case I chose php 7.1)[lauren@server test]$ /opt/cpanel/ea-php71/root/usr/bin/php -m |egrep 'dom|json' dom json0 -
Thank you for your quick replies. @cPanelLauren I don't have CLI either, so I tried @rpvw method. And it worked, thanks. Does it show the available extensions or are they all enabled? There are 65 in the list so this got me intrigued.. (I got to admit, since I'm a complete noob, I felt proud just being able to pull this without any knowledge. It's sad I know.) Thanks. 0 -
@cPanelLauren I don't have CLI either, so I tried @rpvw method. And it worked, thanks.
That's fine, I'm glad it worked for you, I just wanted to give you all the options :)Does it show the available extensions or are they all enabled? There are 65 in the list so this got me intrigued..
. All the ones it lists are enabled extensions with what @rpvw provided. It's the equivalent of running:php -m
which lists all loaded php extensions for that version of PHP(I got to admit, since I'm a complete noob, I felt proud just being able to pull this without any knowledge. It's sad I know.)
I think this is great, you've got to start somewhere and this was useful for you as well as others I'm sure, nice job! Thanks!0 -
Just to stick my nose in here for a moment: (I got to admit, since I'm a complete noob, I felt proud just being able to pull this without any knowledge. It's sad I know.)
Assuming you added that file to your server as suggested, be sure to remove it when its no longer needed. ;)0 -
@cPanelLauren Thanks, mighty kind of you! Also, this little exercise got me interested to learning some coding actually, rather than relying on ready-for-use plugins and softwares. It still looks like witchery to me (especially what you can accomplish with it). @Infopro I will, thanks! This was my first post on the board, and I'm lready (very) positively surprized by the support. Glad to be using cPanel! 0
Please sign in to leave a comment.
Comments
6 comments