Home >Backend Development >PHP Tutorial >curl out of memory window, PHP calls curl and reports insufficient memory_PHP tutorial

curl out of memory window, PHP calls curl and reports insufficient memory_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:57:491181browse

This article will introduce to you the solution to the curl out of memory error when calling curl in PHP under window. Friends who have encountered such problems can refer to it.


Today, when I called the Sina Weibo API (SDK downloaded from the official website), I found that posting pictures on Weibo failed, and the error message said:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294962523 bytes) in XXXsdksinasaetv2.ex.class.php on line 396
I really don’t understand. Why don’t I just upload a picture? Does it require such a large memory? ?

I started thinking about the SDK provided by the official website. If there was a problem with the code, other developers must have encountered it, so I went to the Sina Weibo development platform to find the answer. Strangely, no one mentioned it (I don’t know if everyone has encountered it) This is still a problem). There is no other way but to ask Google.

After checking, I really got some clues. Most of the problems occurred because: using curl to request https, and there was a problem when obtaining the certificate. This post seems to be fair: CURLOPT_SSL_VERIFYPEER caused trouble, I feel bad If you are interested in children's shoes, you can take a look. But this is not the reason for me, so let’s not go too far and continue to solve my own mistakes.

If the above post doesn’t work, keep looking.

But a sentence in this reminded me, "The server in question is Windows and the one working is Linux.". This is interesting. The problem may lie in the PHP version or the operating system, so I put the code on Linux and tested it. I found that there was really no problem. I was very happy.
So I added the keyword "window" and searched again. It was indeed like this. The official website of php appeared decisively in the search results. The answer is here: http://windows.php.net/.

Take a look at your php version 5.2.5, you deserve to have problems, please upgrade quickly if you don’t work hard.

Not much to say, but I discovered this again when I was writing an article (using the Weibo API to post a Weibo with pictures, it prompted that the memory was insufficient. This guy is much worse than me. I guess after adding all the memory. Only then did I realize that it was a bit confusing, haha), and it took no effort at all (unfortunately, the problem was already discovered by me at this time, but it has not been solved yet).

Solution: The simple solution is to upgrade php. The more dedicated method is of course to change the code yourself. How to change this is a question. I said that I am not dedicated and I am too lazy to upgrade.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632067.htmlTechArticleThis article will introduce to you the error of curl out of memory when calling curl in PHP under window. For solutions, friends who have encountered such problems can refer to them. Calling Sina WeChat today...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn