title: php fopen: failed to open stream: Connection timed out
body: <p>$ php ./fopen_google.php </p>
  
  <pre><code>&lt;?php
  $url = 'https://www.google.com'; //this doesn't work, https!
  #$url = 'http://www.cmsrs.pl'; //this work with: http
  $fp = fopen($url, 'r');
  var_dump( $fp );
  ?&gt;
  </code></pre>
  
  <p>And give me error:</p>
  
  <p>PHP Warning:  fopen(<a href="https://www.google.com" rel="nofollow noreferrer">https://www.google.com</a>): failed to open stream: Connection timed out in ./fopen_google.php on line 5</p>
  
  <p>I have no idea why I have got this error, I try use curl and also set:</p>
  
  <pre><code>set_time_limit(10);
  ini_set('max_execution_time', 300);
  </code></pre>
  
  <p>But I have got still the same error.</p>
  
  <p>This is my curl code that, give me content of google:</p>
  
  <pre><code>&lt;?php
  $url = 'https://www.google.com';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  $retval = curl_exec($ch);
  print_r($retval);
  ?&gt;
  </code></pre>
  
  <p>So I think I haven't got problem with connection, but something wrong with php fopen and ssl</p>
  
  <p>I use </p>
  
  <pre><code>$ php -v
  PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr  8 2020 15:45:57) ( NTS )
  Copyright (c) 1997-2018 The PHP Group
  Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
      with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies
      with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
  
  
  
  $ php -i | grep ssl
  Registered Stream Socket Transports =&gt; tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
  openssl
  Openssl default config =&gt; /usr/lib/ssl/openssl.cnf
  openssl.cafile =&gt; no value =&gt; no value
  openssl.capath =&gt; no value =&gt; no value
  </code></pre>
  
  <p>My main problem is install  'laravel/ui' into my private project it is:</p>
  
  <pre><code>$ composer require laravel/ui
  In RemoteFilesystem.php line 515:
  
    The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out  
  
  require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [&lt;packages&gt;]...
  </code></pre>
  
  <p>I have got the same error when I use "fopen" to download google.com content.</p>