1

I was trying to get started with Laravel just last night, so I tried to install it with composer but it wouldn't go through and kept sayin The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. , so I looked around and found out that you need to tell composer to use a proxy.(q1 q2 q3).

Well now this might sound silly but honestly I had no idea what a proxy was until last night, so I went and studied it a bit and I got this far:

"Proxy means to act on behalf of another. In the context of a Web server, this means
one server fetching content from another server, then returning it to the client"

and apparently there's 2 kinds of proxy: forward proxy and reverse proxy.

In those 3 pages that I just showed, they were saying before runing php bin\composer global require "laravel/installer=~1.1" you have to set an env var like this: set http_proxy=username:password@proxy_server:port So now my question is: I still don't know where can I get a proxy like that, should I set it up myself with apache? is that gonna even work? what do I do?
Your thoughts would be appreciated, thank you.

Edit:
Environment info:
I'm on windows 7
installed xampp-win32-5.6.14-0-VC11-installer
all of those 5 important extensions are all enabled in phpinfo()
the path= C:\Users\UserName\AppData\Roaming\Composer\vendor\bin is set in environment variables
here's a picture of the whole error
here's the result of php -m i.stack.imgur.com/wz030.png

Some stuff that I tried:
I went into these sites: proxy4free.com us-proxy.org proxylist.hidemyass.com ultraproxies.com, I tried this: set https_proxy=https://xteamweb.com:xteam@75.55.165.86:8088
and this one: set http_proxy=http://1proxy.space
and many others from those sites: i.stack.imgur.com/6YWyp.png
but no matter what, this is the result of all of them: i.stack.imgur.com/mqOrP.png

Still nothing...

Community
  • 1
  • 1
asdasd
  • 13
  • 1
  • 5
  • What is your operating system? How have you setup the environment, by installing a premade stack like XAMPP, or did you install everything yourself? Are you behind a proxy yourself? Because proxies are not the only cause of that error. You need to provide more info about your environment, because the other questions you referenced might not be equivalent to yours. – Bogdan Nov 03 '15 at 15:22
  • Is that the entire error message? Because sometimes composer spits out more error details after that first sentence. – Bogdan Nov 03 '15 at 15:30
  • +Bogdan "Are you behind a proxy yourself?", I still don't know what that means – asdasd Nov 03 '15 at 15:39
  • If you run `php -m` in your command prompt, do you see `openssl` in the list of modules outputed by the command? – Bogdan Nov 03 '15 at 15:45
  • yes there is `openssl` in that list. (help please) – asdasd Nov 03 '15 at 18:43
  • Open your browser. Go into the settings, network related. Search for the setting that likely is labeled "proxy": Any entries? The regular internet connection does not need a proxy, these only come into play if you are in a corporate network (to prevent you from going to websites unsuitable for work - whatever that means) or if you are using some kind of security software that promises to filter your incoming traffic and remove viruses (which is another story about failure that doesn't belong here now). Assume that ANY proxy on the internet will do is wrong, you have to use YOUR proxy. – Sven Nov 05 '15 at 01:44
  • Looking at your error message makes me think that there is no need for a proxy, but for a fix for the SSL connection. Composer states that it cannot verify the SSL certificate. This however may still be related to some installed security software that prevents you from directly accessing SSL-encrypted websites by intercepting the data (man-in-the-middle-attack-style) and changing the certificate into a self-signed bogus one. – Sven Nov 05 '15 at 01:47

1 Answers1

0

Ok here's the solution, if you're having the same problem:
1:
Make sure these are all uncommented in php.ini:

extension=php_openssl.dll
extension=php_curl.dll
extension=php_sockets.dll
extension_dir="E:\xampp\php\ext"
browscap="E:\xampp\php\extras\browscap.ini"

Add these 2 lines at the end of php.ini

curl.cainfo=c:\openssl-1.0.2d-win32\ssl\cert.pem
openssl.cafile=c:\openssl-1.0.2d-win32\ssl\cert.pem

2:
Run this: php -r "print_r(openssl_get_cert_locations());" and you'll get:

Array
(
    [default_cert_file] => c:/openssl-1.0.2d-win32/ssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => c:/openssl-1.0.2d-win32/ssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => c:/openssl-1.0.2d-win32/ssl/private
    [default_default_cert_area] => c:/openssl-1.0.2d-win32/ssl
    [ini_cafile] => c:\openssl-1.0.2d-win32\ssl\cert.pem
    [ini_capath] => 
)

3:
Make these folders:

c:\openssl-1.0.2d-win32
c:\openssl-1.0.2d-win32\ssl
c:\openssl-1.0.2d-win32\ssl\certs
c:\openssl-1.0.2d-win32\ssl\private

Download this: http://curl.haxx.se/ca/cacert.pem.
Rename it to cert.pem and put it in c:\openssl-1.0.2d-win32\ssl\.
Rename it to cert.crt and put it in c:\openssl-1.0.2d-win32\ssl\certs\.
So:

c:\openssl-1.0.2d-win32\ssl\cert.pem
c:\openssl-1.0.2d-win32\ssl\certs\cert.crt

4:
Download https://getcomposer.org/Composer-Setup.exe and install it, It will no longer gives u the ERR_CONNECTION error.
Go to c:\users\YOURUSERNAME.
composer.bat should be there, if not create it yourself.
Add c:\users\YOURUSERNAME to your path.
Edit composer.bat and delete what's in it and put this in @php "%~dp0composer.phar" %*.
Download https://getcomposer.org/composer.phar.
Place composer.phar in c:\users\YOURUSERNAME.

5:
Done.
Composer will now install laravel using: composer global require "laravel/installer=~1.1" with no problem.
(Plus: now composer command is available globally instead of using it like: php composer.phar or php bin\composer).

asdasd
  • 13
  • 1
  • 5