Composer can not connect to packagist on HTTP and HTTPS - composer-php

I want to Install Laravel in my PC via Composer. But it produces an error
It was the result after I ran "composer diagnose" command
I've tried to solve this problem by updating composer, re-installing xampp, make firewall disabled, changing DNS of IPv4, make IPv6 disabled but all were failed. What should I do? Thanks in advance

Related

failed to install laravel dusk

Hi I use laravel 7 and I use wamp server and windows 10 as the os
I've successfully added laravel dusk to the project by using
composer require --dev laravel/dusk
then I tried to install dusk scaffolding and chrome driver by running below command
php artisan dusk:install
then I've got below results
Dusk scaffolding installed successfully.
Downloading ChromeDriver binaries...
ErrorException
file_get_contents(): php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.
The problem was I am from Iran and Iran is in suspended countries and by using the VPN this problem solved for me

Why does Dusk show error "This site can't be reached" ERR_CONNECTION_REFUSED after my Homestead upgrade?

I've enjoyed Laravel, Homestead, and Dusk for years. Everything was working fine, but I recently needed to upgrade to PHP 7.4 for a new package I wanted to install, so I went ahead and upgraded VirtualBox, Vagrant, etc to:
vboxmanage --version = 6.1.2r135662
Vagrant 2.2.7
laravel/homestead (virtualbox, 9.2.0)
Homestead v10.2.0
Laravel 6.13.1
Dusk v5.9.0
Ubuntu 18.04.3 LTS
PHP 7.4.1
Windows 10 is the host
Now, when I run my Dusk browser tests, they produce screenshots with this error in Chrome: "This site can't be reached" ERR_CONNECTION_REFUSED
But in Windows Chrome, I can browse to my local site fine, as usual (Windows is the host of my Homestead box).
My APP_URL in .env is (and has always been) APP_URL=https://abc.192.168.1.105.xip.io:44300, and it's the same in my .env.dusk.local file, which I've always had.
In Vagrant, when I run wget https://abc.192.168.1.105.xip.io:44300, the result says failed: Connection refused. But if I run wget 127.0.0.1, it downloads the correct page.
So then I figured I could change my APP_URL to 127.0.0.1 (although I wouldn't know why my upgrades would lead me to be required to make that change).
However, then the error in the Dusk Chrome screenshot becomes "Your connection is not private" NET::ERR_CERT_AUTHORITY_INVALID.
I have not found the docs at https://laravel.com/docs/6.x/dusk#installation to help with these problems. Ideas?
P.S. If I change to APP_URL=https://google.com, the screenshot successfully shows Google. So at least Chrome is installed properly in Homestead.
I got it working. I don't understand why these steps seem to be necessary since they were never necessary in my prior experience using Dusk, and no documentation mentioned them as newly necessary due to recent upgrades.
I removed ":44300", so now my .env.dusk.local says APP_URL=https://abc.192.168.1.105.xip.io
Then, running Dusk led to the "Your connection is not private" NET::ERR_CERT_AUTHORITY_INVALID error again, so I figured I needed to tell the Homestead Chrome browser to trust the self-signed certificate. https://stackoverflow.com/a/49612084/470749 and https://stackoverflow.com/a/22813705/470749 led me to run:
sudo apt-get install libnss3-tools
vagrant#vboxHomestead:~/Code/myproject$ cat /etc/nginx/ssl/ca.homestead.vboxHomestead.crt > ca.homestead.vboxHomestead.crt
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "ca.homestead.vboxHomestead.crt" -i ca.homestead.vboxHomestead.crt
Now Dusk runs again.

404 - Not Found when I try to browse to my local WebServer using the IP

So I'm developing responsive websites and obviously need to test these via phones and tablets and it used to work fine, up until yesterday, after I tried installing js frameworks like npm.
For some reason, when I browse to my local testing using the ip it get:
404 - Not Found
I've been used to using:
http://192.168.0.2/filename.php
I've tried:
http://192.168.0.2:8080/filename.php
...still get 404 - Not Found
I've restarted Apache and checked the the port is correct, and it is.
Listen 80
This happened before when I installed Laravel and Valet, but not long after that I had to wipe my Mac due to work and it started working again with a fresh install.
Am I missing something in Apache? does npm and Laravel mess with the Apache settings?
Locally, everything works fine. I can browse to localhost/filename.php directly using Mac with PHP and MySQL talking to each other, albeit after using Homebrew to install MySQL, PHP connections now only accepts 127.0.0.1 rather than localhost.
I've set all the permissions to "everyone" there should be no access issues.
I've noticed another oddity with Firefox Dev Ed too. When I've been using Valet or Gulp, it stops connecting and give a Cannt connect to server error, but Safari and Chrome seem to work ok.
If anyone can shed some light on this, I'd be happy to give it a go!
All fixed! It was Larvel's Valet installation that was causing the issue, as suspected.
So, looked at the brew Cellar directory in /usr/local/Cellar, but it wasn't actually in there. Then opened up Terminal and typed:
valet install
Then ran valet by typing:
valet
Then uninstalled valet by typing:
uninstalled valet
Then restarted Apache2 by typing:
sudo apachectl restart
adding password
Booted up the browser and browsed to localhost/info.php which holds the line <?php phpinfo() ?> and HAPPY DAYS :)

I can't open api.github.com on my computer (Laravel installation)

I want to install Laravel with Composer on my computer. Many time tried it but always I'm getting the error message :
connection failed
After some analysis I found my computer can't connect to api.github.com
I can connect github.com or another million of websites. But only api.github.com is inaccessible.
Chrome says :
ERR_CONNECTION_TIMED_OUT
I disabled firewall, closed antivirus, tried to use Cyberghost VPN but unfortunately cant find any solution.
I don't want to install Windows again. it's take too long time for me. Can anyone suggest things for me to solve my problem?
If you can't install laravel using composer, simply download the project from https://github.com/laravel/laravel and change rename .env.example file to .env
and run
php artisan key:generate
to generate APP_KEY and you all set

Install Laravel behind proxy

Im trying to install Laravel on a windows machine.
I followed this guide up to point 11.
http://www.wikihow.com/Install-Laravel-Framework-in-Windows
I also ran two commands already (which I got from https://stackoverflow.com/a/18852026/2240163)
set http_proxy=<your_http_proxy:proxy_port>
set https_proxy=<your_https_proxy:proxy_port>
But on running composer install i am met with a message
C:\wamp\www\LARAVEL>composer install
Loading composer repositories with package information
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: SSL
: The specified procedure could not be found.
failed to open stream: Cannot connect to HTTPS server through proxy
How can I get past the proxy to install Laravel 4.
.
.
Here in lay the solution
C:\wamp\www\LARAVEL>set http_proxy=http://mnel:******#192.168.20.4:8080
C:\wamp\www\LARAVEL>set https_proxy=https://mnel:******#192.168.20.4:8080
I then ran the install composer command again and presto!
https://stackoverflow.com/a/24958700/2240163
Thanks #mneute
Here in lay the solution
C:\wamp\www\LARAVEL>set http_proxy=http://mnel:******#192.168.20.4:8080
C:\wamp\www\LARAVEL>set https_proxy=https://mnel:******#192.168.20.4:8080
I then ran the install composer command again and presto!
https://stackoverflow.com/a/24958700/2240163
Thanks #mneute
I got this same issue when I ran composer -vvv install. I did it in windows7 computer behind a company firewall. I search and tried every possible answer but didn't work. Then I tried following and it did work
https://www.calazan.com/how-to-set-the-proxy-settings-in-windows-via-command-line/

Resources