亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

PHP項目中CURL出現內存泄露如何解決

發布時間:2021-03-04 15:35:32 來源:億速云 閱讀:193 作者:Leah 欄目:開發技術

這期內容當中小編將會給大家帶來有關PHP項目中CURL出現內存泄露如何解決,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

php有什么用

php是一個嵌套的縮寫名稱,是英文超級文本預處理語言,它的語法混合了C、Java、Perl以及php自創新的語法,主要用來做網站開發,許多小型網站都用php開發,因為php是開源的,從而使得php經久不衰。

curl配置平淡無奇,長時間運行發現一個嚴重問題,內存泄露!不論用單線程和多線程都無法避免!是curl訪問https站點的時候有bug!

內存泄露可以通過linux的top命令發現,使用php函數memory_get_usage()不會發現。

代碼如下:


[CURLOPT_HTTPPROXYTUNNEL] = true;
[CURLOPT_SSL_VERIFYPEER] = false;
[CURLOPT_SSL_VERIFYHOST] = false;

CURLOPT_HTTPPROXYTUNNEL具體說明stackoverflow上有,直接貼原文:

Without CURLOPT_HTTPPROXYTUNNEL

Without CURLOPT_HTTPPROXYTUNNEL : You just use the proxy address/port as a destination of your HTTP request. The proxy will read the HTTP headers of your query, forward your request to the destination (with your HTTP headers) and then write the response to you.

Example steps :

1)HTTP GET /index.html sent to 1.1.1.1 (proxy)
2)1.1.1.1 receive request and parse header for getting the final destination of your HTTP request.
3)1.1.1.1 forward your query and headers to www.site.com (destination in request headers).
4)1.1.1.1 write back to you the response receive from www.site.com

With CURLOPT_HTTPPROXYTUNNEL

With CURLOPT_HTTPPROXYTUNNEL : You ask the proxy to open a direct binary connection (like HTTPS, called a TCP Tunnel) directly to your destination by doing a CONNECT HTTP request. When the tunnel is ok, the proxy write you back a HTTP/1.1 200 Connection established. When it received your browser start to query the destination directly : The proxy does not parse HTTP headers and theoretically does not read tunnel datas, it just forward it, thats why it is called a tunnel !

Example steps :

1)HTTP CONNECT sent to 1.1.1.1
2)1.1.1.1 receive HTTP CONNECT and get the ip/port of your final destination (header field of HTTP CONNECT).
3)1.1.1.1 open a TCP Socket by doing a TCP handshake to your destination 2.22.63.73:80 (ip/port of www.site.com).
4)1.1.1.1 Make a tunnel by piping your TCP Socket to the TCP Socket opened to 2.22.63.73:80and then write you back HTTP/1.1 200 Connection established witch means that your client can now make your query throw the TCP Tunnel (TCP datas received will be transmited directly to server and vice versa).

http://stackoverflow.com/questions/12288956/what-is-the-curl-option-curlopt-httpproxytunnel-means

上述就是小編為大家分享的PHP項目中CURL出現內存泄露如何解決了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

北流市| 贡山| 西安市| 南宁市| 礼泉县| 祁阳县| 昆山市| 称多县| 蕉岭县| 新乐市| 什邡市| 肥乡县| 桂阳县| 达州市| 沿河| 肥西县| 天门市| 黄陵县| 台中县| 富裕县| 于都县| 兴国县| 开封县| 博罗县| 广水市| 滕州市| 东平县| 左云县| 天镇县| 科尔| 宁乡县| 漳平市| 漠河县| 曲周县| 泸水县| 太康县| 积石山| 玉溪市| 扬州市| 佛坪县| 稷山县|