Giter Club home page Giter Club logo

Comments (3)

selimonline avatar selimonline commented on July 20, 2024 2

exact same issue. any ideas?

from firebase-php.

ivent avatar ivent commented on July 20, 2024

Hello, I have not made any improvements to my pho code but I still have a delay with regards to the library that needs to be solved. In javascript the updates are so fast that they seem to be instantaneous php should behave the same way or close to that rs

from firebase-php.

mastef avatar mastef commented on July 20, 2024

@ivent @selimonline I had some very slow initial & consecutive requests ( 5-7 seconds per request ) and the changes below are how I resolved them. Also while debugging you can use curl_setopt($this->_ch, CURLOPT_VERBOSE, true); to see where it's hanging.

My getCurlHandler has the following added lines :

+        curl_setopt($this->_ch, CURLOPT_HTTPGET, true); // <-- to reset CURLOPT_POSTFIELDS
         curl_setopt($this->_ch, CURLOPT_URL, $url);
         curl_setopt($this->_ch, CURLOPT_TIMEOUT, $this->_timeout);
         curl_setopt($this->_ch, CURLOPT_CONNECTTIMEOUT, $this->_timeout);
+        curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, false); // <-- set to false to speed up SSL connections ; do at your own risk
         curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, true); 
         curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
+        // curl_setopt($this->_ch, CURLOPT_VERBOSE, true); // <-- for debugging, turn off after you're done
         curl_setopt($this->_ch, CURLOPT_CUSTOMREQUEST, $mode);
+        curl_setopt($this->_ch, CURLOPT_HTTPHEADER, []); // <-- reset headers when switching from write to read
+        curl_setopt($this->_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // <-- force ipv4, helps with servers that have ipv6 dns lookups misconfigured

@ktamas77 you might want to consider some of these. I think it's mainly the ipv6 lookups on servers that don't support ipv6 that are slowing down Curl; as it tries to look up the host with ipv6 and then falls back on ipv4 after it fails. Might want to have an option for this, similar to the SSL option in a recent version. Related SO : https://stackoverflow.com/a/26568867/10728554

from firebase-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.