Killy89

Registered
Jul 11, 2018
3
2
3
Morocco
cPanel Access Level
Website Owner
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.
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
466
113
UK
cPanel Access Level
Root Administrator
You could try this:
In your /public_html folder, create a file called eg showext.php and then add the following content
PHP:
  <?php
     echo "<pre>";
     print_r(get_loaded_extensions());
     echo "<pre/>";
 ?>
Now call the file in a web browser and you should get a list of all the loaded extensions
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,298
1,279
313
Houston
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:
Code:
[[email protected] test]$ php -m |egrep 'dom|json'
dom
json
for a specific PHP version (in my case I chose php 7.1)
Code:
[[email protected] test]$ /opt/cpanel/ea-php71/root/usr/bin/php -m |egrep 'dom|json'
dom
json
 

Killy89

Registered
Jul 11, 2018
3
2
3
Morocco
cPanel Access Level
Website Owner
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.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,298
1,279
313
Houston
@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:
Code:
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!
 

Infopro

Well-Known Member
May 20, 2003
17,085
521
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
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. ;)
 

Killy89

Registered
Jul 11, 2018
3
2
3
Morocco
cPanel Access Level
Website Owner
@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!