
How to Manage PHP Extensions with phpquery on Debian-Based Systems
Managing PHP Extensions with phpquery on Debian-Based Systems
Efficient management of PHP versions and extensions is vital for developers and system administrators working on Debian-based operating systems. The phpquery
command-line tool provides a straightforward way to handle PHP configurations, allowing you to list available PHP versions, check extension statuses, and manage SAPIs (Server API interfaces) seamlessly.
What is phpquery?
phpquery
is a lightweight PHP extension manager designed specifically for Debian-based OSes. It simplifies tasks such as discovering installed PHP versions, enabling or disabling extensions, and verifying if particular extensions are active for different SAPIs like CLI or Apache2. For more detailed information, visit the official documentation: https://helpmanual.io/help/phpquery/.
Key Features and Usage
1. Listing Available PHP Versions
To see all PHP versions installed on your system, simply run:
sudo phpquery -V
This command provides an overview of the PHP versions present, helping you choose the right version for your projects.
2. Listing SAPIs for a Specific PHP Version
If you want to view the available SAPIs (like CLI, Apache2, FPM) for a particular PHP version, for example PHP 7.3, use:
sudo phpquery -v 7.3 -S
This helps you understand the server interfaces you can configure for PHP 7.3.
3. Checking Enabled Extensions for a Specific PHP Version and SAPI
To verify which extensions are active for PHP 7.3 with the command-line interface (CLI), execute:
sudo phpquery -v 7.3 -s cli -M
This command lists all the extensions currently enabled in the CLI environment.
4. Verifying if a Specific Extension is Enabled for a Given SAPI
Suppose you want to check if the JSON extension is enabled for PHP 7.3 when running under Apache2. You can do so by executing:
sudo phpquery -v 7.3 -s apache2 -m json
If the extension is active, it will be listed in the output; otherwise, it isn’t enabled in that environment.
Why Use phpquery?
Managing PHP extensions manually via configuration files can be tedious and error-prone. phpquery
abstracts this complexity, providing clear commands for typical tasks:
- Quickly view installed PHP versions
- Check or modify extension statuses
- Confirm the active SAPIs and configurations for different environments
This tool streamlines maintaining multiple PHP versions and configurations, ensuring your development or production servers are properly set up.
Final Thoughts
Whether you’re managing a single server or multiple environments, phpquery
offers an efficient way to oversee your PHP setups on Debian-based OSes. Mastering its commands will help you maintain optimal PHP performance and compatibility across your projects.
For more details and advanced usage, visit the official help manual: https://helpmanual.io/help/phpquery/.