phpapachecentos7mpdf

My PHP is 7.4 and composer says it is 5.4


I am running Centos 7 with Plesk my Plesk says the php module 5.4.16 is not even loaded.

When I run php -v I get:

PHP 7.4.33 (cli) (built: May 7 2024 14:26:50) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with the ionCube PHP Loader + ionCube24 v11.0.1, Copyright (c) 2002-2022, by ionCube Ltd. with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

But I still get this error in composer:

Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 5.4.16, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.

I have tried every fix I could find but nothing is working. Can someone please point me in the direction of a real solution.


Solution

  • Important: See the documentation link below about Plesk Obsidian using a composer extension. If you are using Plesk Obsidian this is the recommended way to run composer on a plesk server.

    From the Plesk documentation:

    Run Composer from a command-line interface

    Where X.X is a PHP version:

    Documentation links:

    https://www.plesk.com/kb/support/how-to-run-composer-with-plesk-php/

    https://www.plesk.com/extensions/composer/