Your Composer dependencies require a php version fixed

PHP is a popular server side scripting language, helps to build dynamic web page. Mostly developers like PHP to build website because it is simple and easy to deploy. But sometime we get an error 'Composer detected issues in your plateform: Your composer dependencies require a PHP version ">= 8.1.0"', when we deploy our website on server.

This is seen when we work on Laravel or other PHP's framework. It means your composer version is not compatible with your current PHP version.


composer detected issues


This issue often occurs when we develop our website in PHP latest version and server PHP version not upgraded. So, either we can upgrade our server PHP version or can install the same PHP version and composer in our local system.

There are two ways to fix this problem:

  • Upgrade your server PHP version
  • Change PHP configuration of your local system

We will use both the methods one by one, just follow the following steps and read the article till last line for better understanding.

1. Upgrade your server PHP version

Step 1:

Go to the cpanel and find the 'Software' section, under Software section click on 'Select PHP Version'

Upgrade PHP version of Gpdaddy hosting



Step 2:

A new screen will be opened, select your required PHP version. Come to your project and refresh it.

Godaddy PHP version


If you don't want to upgrade your current PHP version and want to run your laravel project on current version, then you have to install or reduce composer version that can work with current PHP version.

Just follow the second method, and I ensure you, the problem will be resolved.


Change PHP configuration of your local system

Be careful during changing the configuration. Here is the guide to install PHP in Ubuntu. Same approach can be followed to install in any operating system.

Step 1: Check PHP Version

First of all check your PHP version by using command 'php -v' on your terminal.

$ php -v
PHP 7.3.0 (cli) (built: Dec 21 2023 20:19:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.27, Copyright (c) Zend Technologies
with Zend OPcache v8.1.27, Copyright (c), by Zend Technologies

In my case, PHP version is '7.3.0' and I have to install PHP 8.1.
Either we can remove our current version or can install PHP 8.1 directly.

Step 2: List of Installed Version

Check the list of PHP version installed in your system. Use command 'sudo update-alternatives --list php'

$ sudo update-alternatives --list php

Step 3: Install Specific PHP Version

Run the following command to install the specific PHP version in your system.

$ sudo apt-get install php8.1

Step 4: Install Required Packages

Now, run the command on your terminal to install all required packages in PHP.

$ sudo apt-get install -y php8.1-cli php8.1-common
php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath

These are the required modules to install:

  • php8.1-cli : It is a command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks
  • php8.1-common : documentation, examples, and common modules for PHP
  • php8.1-mysql : for working with MySQL databases
  • php8.1-zip : for working with compressed files
  • php8.1-gd : for working with images
  • php8.1-mbstring : used to manage non-ASCII strings
  • php8.1-curl : lets you make HTTP requests in PHP
  • php8.1-xml : for working with XML data
  • php8.1-bcmath : used when working with precision floats

But, still it is not complete, we need to configure our latest installed PHP8.1. So, to do this follow the step 5.

Step 5: Select Specific Version of PHP

To configure PHP8.1, run 'sudo update-alternatives --config php' command in terminal.

$ sudo update-alternatives --config php

When you run this command, a list of PHP version will be displayed and you will be asked to choose a PHP version. You just have to enter the serial number of the specific version and press enter.

For example:


Your current version display with asterisk '*' sign in the list.

Now you can run the command 'php -v' to check it is configured or not. This process will install the specific version of PHP that you need.

Previous Post Next Post