I got this error:
Composer issue when trying to install "phpoffice/phpspreadsheet". SSL certificate problem: self-signed certificate in certificate chain
When i was trying to install phpoffice/phpspreadsheet using the command
composer require phpoffice/phpspreadsheet
inside my CodeIgniter 4 project.
I then tried to use this command on the CMD because i thought i need an SSL certificate file.
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365
and used the "cert.pem" file on my composer.json like this, but it still doesn't work. The command above created 2 file, which is "cert.pem" and "key.pem".
{
"name": "codeigniter4/framework",
"description": "The CodeIgniter framework v4",
"license": "MIT",
"type": "project",
"homepage": "https://codeigniter.com",
"require": {
"php": "^8.1",
},
"autoload": {
"psr-4": {
"CodeIgniter\\": "system/"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"disable-tls": true,
"secure-http": false,
"options": {
"ssl": {
"verify_peer": false,
"allow_self_signed": false,
"cafile": "C:/key_for_composer/cert.pem",
"local_cert": "C:/key_for_composer/cert.pem"
}
}
},
"scripts": {
"test": "phpunit"
}
}
Doesn't work. I also tried this command:
composer config -g cafile "C:/key_for_composer/cacert.pem",
i got the file cacert.pem from "https://curl.se/docs/caextract.html".
Still doesn't work.
Please help me with this issue. My Composer knowledge is quite lacking.