Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to check active PHP extension

Discussion in 'EasyApache' started by Killy89, Jul 11, 2018.

  1. Killy89

    Killy89 Registered

    Joined:
    Jul 11, 2018
    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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.
     
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    696
    Likes Received:
    233
    Trophy Points:
    93
    Location:
    Spain
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    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:
    [lauren@server test]$ php -m |egrep 'dom|json'
    dom
    json
    
    for a specific PHP version (in my case I chose php 7.1)
    Code:
    [lauren@server test]$ /opt/cpanel/ea-php71/root/usr/bin/php -m |egrep 'dom|json'
    dom
    json
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Killy89

    Killy89 Registered

    Joined:
    Jul 11, 2018
    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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.
     
  5. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    That's fine, I'm glad it worked for you, I just wanted to give you all the options :)

    .
    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 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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,242
    Likes Received:
    385
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Just to stick my nose in here for a moment:
    Assuming you added that file to your server as suggested, be sure to remove it when its no longer needed. ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    rpvw and cPanelLauren like this.
  7. Killy89

    Killy89 Registered

    Joined:
    Jul 11, 2018
    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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!
     
    Infopro and cPanelLauren like this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice