How can I install the Composer dependency manager when its installer has issues with my php.ini file?

3 days ago 2
ARTICLE AD BOX

I am trying to install the Composer dependency manager, hoping to use it to install phpdotenv, with the ultimate intention of linking a .env file to a PHP application I am writing for a university project (the database settings for the app will be stored in the .env file so they won't be exposed in the GitHub repo for the app).

When I ran the Composer installer it flagged up problems with my php.ini file.

I identified and fixed some problems, eg:

I didn't have a php.ini file, but I found a "php.ini-development file", which I copied, then renamed the copy "php.ini"

After that, 3 problems were identified with the php.ini file, and I uncommented the lines referred to in the error message, relating to curl, mbstring and openssl

I am still getting an error message, although now it doesn't say that anything is missing, but simply states the location of the php.ini file:

Composer needs the following settings to be enabled in your php.ini file. Required settings: The php.ini used by your command-line PHP is: C:\Program Files\php-8.5.3\php.ini

enter image description hereWhile barely knowing what I am talking about, I suspect the problem may relate to the %PATH% environment variable for PHP, because when I was trying to find the php.ini file I realised I have two folders for PHP, one in the C drive and one in my C:\Xampp folder. It seems Composer is trying to use the former.

Could this be the problem, and if so, how can I fix it?

(And if not, what is the problem and how do I fix that??)

Read Entire Article