If you are facing an error “PHP php-config is not installed” when trying to compile and install PHP extensions with php-config in Ubuntu 16.04.1 LTS with PHP 7.0.33, it means that php-config is not available on your system. Here’s a step-by-step guide on how to fix this issue:
Step 1: Check if php-config is installed
To check if php-config exists on your system, open a terminal window and run the following command:
whereis php-config
If it returns null or no output, it means that php-config is not installed on your system.
Step 2: Install php-dev package
To install php-config, you need to install the php-dev package. Run the following command in the terminal:
sudo apt-get update
sudo apt-get install php-dev
If you are using PHP 5, run the following command instead:
sudo apt-get install php5-dev
Step 3: Verify installation of php-config
After installing php-dev, run the whereis command again to verify whether php-config is now available or not:
whereis php-config
If it is installed successfully, it should return something like this:
php-config: /usr/bin/php-config /usr/bin/php-config7.0 /usr/share/man/man1/php-config.1.gz
Step 4: Compile and Install PHP Extensions
Now that you have successfully installed php-config, you can use it to compile and install PHP extensions.
Related : ImportError: No module named ‘ConfigParser’
Conclusion:
By following the above steps, you can easily fix the “PHP php-config is not installed” error in Ubuntu 16. This error occurs because of the absence of the php-dev package, which is required for compiling and installing PHP extensions with php-config. After installing the php-dev package, you can verify the installation of php-config and use it to install PHP extensions without any issues.
FAQ
What is the cause of “PHP php-config is not installed” error in Ubuntu 16?
This error occurs when you try to compile and install PHP extensions with php-config, but php-config is not installed on your system. This usually happens because the php-dev package is not installed.
How do I check if php-config is installed on my system?
You can check if php-config is installed on your system by running the command “whereis php-config” in the terminal.If it returns no output or null, it means that php-config is not installed on your system.
How do I use php-config to compile and install PHP extensions in Ubuntu 16?
Once you have successfully installed php-config, you can use it to compile and install PHP extensions. To compile and install PHP extensions with php-config, follow the instructions provided by the extension’s documentation. Usually, it involves running some commands in the terminal.