Unable to use a proxy: malformed http_proxy url - php

I am trying to run a composer command, but I'm getting the error:
[Composer\Downloader\TransportException]
Unable to use a proxy: malformed http_proxy url
What can I do to fix this error?
Here is an image showing the error message:

To solve that, set the proxy to zero using the cmd
set http_proxy=0

I must say, I encountered this issue yesterday and have gone through all kinds of hoops to get it resolved, including watching videos and reading posts (here and elsewhere), none of which worked and potentially could have lead my naïve ass to mess up my Win10 Laptop!
Delete http_proxy in Environment Variables (NO, failed to resolve)
Uninstall/Reinstall Composer (I am on dev desktop and most steps were
for XAMPP)
Remove Proxy URL virus (Various methods N/A)
uncheck Use aProxy server option (N/A)
Run multiple other terminal commands for SSL etc. (NO)
Plus multiple (outdated) YouTubes LOL
run: composer config -g repo.packagist composer https://packagist.org
Everything is N/A from: This post
This method set http_proxy=0 worked like a charm and should be made more readily available!
So thanks!

uninstall composer
after install composer
in that time http proxy field is coming
u can put that one is empty only
[1]: https://i.stack.imgur.com/fBm37.png
this problem is resolve

Related

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

I'm trying to get composer to work on a remote Windows-machine which is using a proxy, but I always get this error when doing a composer install/update:
[Composer\Downloader\TransportException] curl error 60 while
downloading https://flex.symfony.com/versions.json: SSL certificate
problem: unable to get local issuer certificate
This is my composer.bat:
#echo OFF
:: in case DelayedExpansion is on and a path contains !
setlocal DISABLEDELAYEDEXPANSION
set HTTP_PROXY=<proxyurl>
php "%~dp0composer.phar" %*
Obviously setting the proxy is needed, if I delete the line, the error becomes this:
[Composer\Downloader\TransportException] curl error 28 while
downloading https://flex.symfony.com/versions.json: Operation timed
out after 10000 milliseconds with 0 out of 0 bytes received
composer diag gives me this (with the proxy set):
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0.9
PHP version: 7.4.7
PHP binary path: C:\Program Files\PHP\current\php.exe
OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
cURL version: 7.69.1 libz 1.2.11 ssl OpenSSL/1.1.1g
zip: extension present, unzip not available
I've been through a lot of posts and tutorials, but none of the answers work for me. (Some are just about curl and it's options to switch off the cert-check but that doesn't work for composer). Here's what I have tried:
Downloaded cacert.pem from http://curl.haxx.se/ca/cacert.pem or https://curl.se/docs/caextract.html (no copy&paste as some said editing the file would corrupt it - however that's supposed to happen)
saved the file locally
activated openssl in php.ini
edited php.ini and added the path of the cert-file for "curl.cainfo" as well as "openssl.cafile" (according to some posts that makes a difference, so I tried both), used the full path and quotes, like this: curl.cainfo="C:\Program Files\PHP\cacert.pem"
moved the pem-file to different directories to make sure no Windows-permissions would make it inaccessible (I also set the file and it's directory to be accessible by all users just to make sure)
used php -r "print_r(openssl_get_cert_locations());" to find out the default certfile-location (it's "C:\Program Files\Common Files\SSL"), also saved the cert-file there
All of this did not work, the error remains the same.
Then I found a post which set a repository in composer.json and explicitely set the certfile for that repo, so I also tried it and added this to my composer.json:
{
"repositories": [{
"type": "composer",
"url": "https://flex.symfony.com",
"options" : {
"ssl" : {
"cafile" : "cacert.pem"
}
}
}]
}
The file "cacert.pem" is in the same directory as my composer.json, now the error is this:
[Composer\Downloader\TransportException] The
"https://flex.symfony.com/packages.json" file could not be downloaded
(HTTP/2 404 )
which is not that surprising, as trying to access "https://flex.symfony.com/packages.json" via a browser also gives me a 404. (Don't know if it makes a difference that all at a sudden "packages.json" couldn't be loaded while the cert-error complained about "versions.json", have no idea which is loaded first and if this error is a "good" sign.)
This trial-and-error journey has been going on for days, I'm out of ideas, so any help is appreciated!
i have no idea if your problem is the same as the problem i just got. but i solved it by executing this in cmd:
composer config -g -- disable-tls false
i'm using wamp anyway.
Further research led me to the proxy, which is ZScaler, being the problem. As stated in this post, ZScaler intercepts SSL traffic and re-encrypts it with its own certificate which is not trusted, so Composer (or any other program accessing sites via https) will complain with the above error that it's "unable to get local issuer certificate".
So the solution must be to get the "ZScaler Intermediate Root CA" to be trusted on the server. (Which I can't do myself due to company policy, but anyone looking for a solution to the above problem probably has another hint now what to do.)
after using the composer config -g secure-http false and clear my composer cache using composer clearcache solved my problem, with WAMP server.
If you use a symfony/flex older than 1.17.1:
composer show symfony/flex
then you need to update it with:
composer update symfony/flex --no-plugins --no-scripts
Source
Linux
(Paths in this guide will assume a default Linux installation on Ubuntu 18.04 LTS, but it will be similar for other distros.)
Download the latest CA bundle extract from curl.se
wget https://curl.se/ca/cacert.pem -O /etc/ssl/certs/cacert.pem --no-check-certificate
Edit your php.ini file.
For Ubuntu 18.04, there are 2 php.ini files which need to be modified in the following locations:
/etc/php//cli/php.ini
/etc/php//fpm/php.ini
Replace the with the version of PHP you’re using, so for PHP 7.4, the path will be /etc/php/7.4/…
In these files, you need to either modify or add the curl.cainfo and openssl.cafile parameters with the path to the new CA bundle:
[curl]
curl.cainfo = /etc/ssl/certs/cacert.pem
[openssl]
openssl.cafile = /etc/ssl/certs/cacert.pem
(only add the parameter if it does not already exist in your php.ini file. Duplicate parameters can prevent PHP from running correctly)
Restart your php-fpm to load the new settings.
systemctl restart php-fpm
Replace the with the version of PHP you’re using, so for PHP 7.4, the command will be systemctl restart php7.4-fpm
DONE!
source: (https://support.deskpro.com/is/kb/articles/how-to-update-curl-trusted-root-certificates)
Yes sometime the issue encounter if system is not connected to Zscaler which is installed by company for security. Connect with Zscaler and re run the command. The issue will get resolved.
https://asset-packagist.org could not be fully loaded (curl error 60
while downloading https://asset-packagist.org/packages.json: SSL
certificate problem: certificate has expired), package information was
loaded from the local cache and may be out of date
I am facing this Issue while composer install on Yii2 Project Operating System Windows and Wamp
I update the Certificate using this Video SSL certificate on Wamp
Still facing same issue at last I update the composer using command composer self-update Everything works fine I update composer version from 2.1.8 to 2.2.7
Update keys using:
composer self-update --update-keys
Then follow the instructions (copy and paste the key from https://composer.github.io/pubkeys.html)
Even this an old question and has many answers I found myself that none of them worked for me. In my case I've a local development environment using Docker, so using some sort of OS-hack would not work since is not persistent and furthermost cannot be passed down to any of my teammates (yes I know I could have my own image but does not worth the effort). The issue was raised while using the assets-packagist repository.
I solve this using this post, and for that I downloaded the cacert.pem at my project root dir and bound it to my container and set the repository as follows:
"assets": {
"type": "composer",
"url": "https://asset-packagist.org",
"options": {
"ssl": {
"verify_peer": true,
"allow_self_signed": true,
"cafile": "/var/www/html/cacert.pem"
}
}
}
This way any composer command work and trust in the registry certificate.
It seems you made the mistake of going on the wrong path
If you are using PHP version php7.4.21
CORRECT : Applications/MAMP/bin/php/php7.4.21
WRONG : Applications/MAMP/config/php7.4.21

Symfony returning error : some parameters are missing. Please provide them

I'm trying to install symfony on wamp server, i'm installing through composer. I tried below command in cmd
$ composer create-project symfony/framework-standard-edition sym2
Above command is installing properly symfony latest version on wamp but in the end it returning an error or request for edit something.
Creating the "app/config/parameters.yml" file`
I attached cmd screen shot for the reference, can any on guide me how can i solve this issue. I have also update the composer phar before installing symfony.
It's not a bug (error), it's a feature.
There's no error, only information.
CMD waits for you to provide values for these missing parameters. Right here in the command line, not directly into parameters.yml file.
Currently on the screen it's waiting for you to provide database_host or simply press enter to apply default value which is shown in the brackets (127.0.0.1).
This is Interactive Management of the parameters.yml File
You can keep everything by default.
All these parameters can be changed later in the app/config/parameters.yml file.

Can't update/install using composer behind a corporate firewall

i'm trying to get composer to work on our server but i keep getting issues trying to install/update repositories.
I have configured the environment variables correctly to achieve all this:
http_proxy=http://fastweb.int.bell.ca:8083/
ftp_proxy=ftp://fastweb.int.bell.ca:8083/
HTTP_PROXY_REQUEST_FULLURI=false
I have also forced my composer to use HTTPS protocol only using the configuration directive:
"config": {
"github-protocols": ["https"]
}
We tried to update the ca_bundle following the post SSL certificate rejected trying to access GitHub over HTTPS behind firewall by setting the GIT_SSL_NO_VERIFY or updating the ca-bundle.crt in /etc/pki/tls/certs...
Nothing seems to work!
Here's the output, it does it for all packages, i tried with and without --prefer-source just to see if it would help, still nothing...
./composer.phar update Loading composer repositories with package
information Updating dependencies (including require-dev)
- Updating crazycodr/data-transform (dev-master 11f8499 => 2.0.2)
Checking out 11f8499d0027468705fca72ab67acfbf8ee2e6be
[RuntimeException] Failed to clone
https://github.com/crazycodr/data-transform.git via git, https and
http protocols, aborting.
- https://github.com/crazycodr/data-transform.git
fatal: https://github.com/crazycodr/data-transform.git/info/refs?service=git-upload-pack not found: did you run git update-server-info on the server?
I confirm being able to clone/pull/push a GitHub repo behind a firewall.
And you do need https_proxy in addition of http_proxy:
set http_proxy=http://<login_internet>:<password_internet>#aproxy:aport
set https_proxy=http://<login_internet>:<password_internet>#aproxy:aport
set no_proxy=.company
(the no_proxy part is there to avoid using the proxy for internal url, internal to the company)

laravel 4 install failure

I have been trying to get laravel installed with no success.
I have been following what seems to be the usual recipe
git clone -b develop git://github.com/laravel/laravel.git myapp
cd myapp
curl -sS https://getcomposer.org/installer | php
php composer.phar install
When I run it I always get the following. I tried killing the cache dir updating etc.
Running PHP Version 5.4.6 open-ssl , mcrypt enabled in the cli.
Just don't know what I'm missing. Been giving it a shot for over a week. Saw some talk about network issues. When I manually download the json in the browser, I notice it redirects to a secure https url. Any pointers would be great. I've have never had a problem like this where I have not been able to dig up the answer.
# php composer.phar install
Loading composer repositories with package information
Installing dependencies
[Composer\Downloader\TransportException]
The "http://packagist.org/p/laravel/framework$de13d7a9bde179aa3dbe63308a250
911fa2330b3e0ba7510dea52827ec3c2f14.json" file could not be downloaded: fai
led to open stream: HTTP request failed!
I noticed with wget or a browser, I would get an https redirect. It seems that however composer does it is different enough from these other 2 that it creates a firewall problem. The link above solved it by adding a section to my composer.json file. Now it doesn't need to redirect as it is starting at https. I am running behind a sonicwall. I am not sure why it would work with a browser and wget, but not composer. It solved it however.
You're cloning the Developer branch from github. This version can be broken in the moment. So you could wait and try it later again (maybe it'll get fixed meanwhile) or you download this develop.zip which is the official way described in the L4 documentation.

pear.php.net is down. How to install mirror?

I was trying to install new packages in my PHP environment development via PEAR but as shown below:
File http://pear.php.net:80/rest/p/packages.xml not valid (received: HTTP/1.1 404 Not Found)
it seems that php.net is down.
I tried to setup a mirror since us.php.net which Digg hosts with the following command:
pear config-set preferred_mirror us.pear.php.net
which gives the following error:
Channel Mirror "us.pear.php.net" does not exist in your registry for channel "pear.php.net".
Attempt to run "pear channel-update pear.php.net" if you believe this mirror should exist as you may have outdated channel information.
Of course I can't update the channel since php.net is down.
Does anyone know how i should proceed?
As it is down, nothing you can do except for waiting it to be up again.
Let's wait together, I cannot do several tasks due to the reason too.

Categories