I wanted to know which PHP extensions I have installed. How do I query that? how do I install specific extensions, once I find out if the ones I need for an installation are missing?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Ey @aecsp2000,
You can check for the package versions installed on the system to get the PHP version:
$ sudo apt list --installed | grep php
PHP extensions are compiled libraries that extend the core functionality of PHP. Extensions are available as packages and can be easily installed with apt.
$ sudo apt install php-[extname]
For example, to install MySQL and GD extensions, you would run the following command:
$ sudo apt install php-mysql php-gd
After installing a new PHP extension, depending on your setup, do not forget to restart Apache or PHP FPM service.
Hope that helps,
Sergio Turpín
Hello,
In addition to what has been mentioned already, another way of doing this is using the following command:
php -m
This will show you all of the loaded PHP modules.
Alternatively, you can also create a PHP info file, called info.php for example, with the following content:
<?php
phpinfo();
Then if you were to visit the file via your browser you will see all of the needed PHP configurations on your server.
Best,
Bobby
Hello there,
I just wanted to share this link if someone is looking into installing PHP 8.1 on the latest Ubuntu 22.04 LTS and also set up a local environment
As Bobby already mentioned, you could list all loaded PHP modules with the following command:
- php -m
You have installed PHP and verified the version you have running. You also installed any required PHP modules and were able to list the modules that you have loaded.
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.