PHP uses file_get_contents or curl to request that the content of the https domain name is null or that the Http 505 error occurs,

Source: Internet
Author: User

PHP uses file_get_contents or curl to request that the content of the https domain name is null or that the Http 505 error occurs,

Some days ago, I suddenly received feedback from users, saying that the original QQ logon and Weibo logon in the system were not available. After tracking code, I found that, an error is reported when the file_get_contents function is used to log on to QQ. When the file_get_contents function is used to request an https address, null is returned and no error is returned!

I have found many posts on the Internet, and the time span is close to three months. This problem is not well resolved. It is said that there is no openssl problem, but my linux system does not need openssl. dll, and I also tried to compile openssl. so and other methods, because my Php environment already contains openssl compilation.

In addition, according to the online tutorial, not only did not solve my problem, but instead encountered a new problem, the original can still return blank content, according to a series of tutorials, 505 error is reported, and errors such as nginx and php cannot be found well. This is nearly a month later.

As the error message of 505 is always returned, I also suspect that it is an error returned by nginx, so that the specific error returned by the underlying php is not visible. I 've been wondering how to bypass nginx and directly access the php page to see the most primitive error? However, nginx cannot be changed at will. After all, the system is still running and users access and submit data.

Two weeks later, the customer had been calling to solve the problem and had no way to stick to it. When I continued to study php, I suddenly found that php is also a command. You can directly use php test. php; test. there is only one file_get_contents function in php, so you can directly and conveniently feedback the original error information.

After the command is executed, the error segment fault is displayed on the console. Continue to use Baidu or google based on this clue. Some friends found that the issue was caused by sqlite. For details, refer to this article.

Http://blog.csdn.net/loophome/article/details/53812887

You can view the system kernel logs to find problems.

By checking the kernel log and gdb record, you can find the problem on libsqlite.

 

Kernel log: tail-f/var/log/messageskernel: php [26564]: segfault at 8048 ip Route 7f7a72fede9c sp route 7fffec90edf0 error 4 in libsqlite3.so. 0.8.6 [7f7a72fd1000 + 8c000] gdb record: Program encoded ed signal SIGSEGV, Segmentation completed in sqlite3_file_control () from/usr/lib64/libsqlite3.so. 0. The most critical way to solve the problem is to delete or rename the two files. This method is feasible! Removing/etc/pki/nssdb/pkcs11.txt and/etc/pki/nssdb/cert9.db now the problem has been solved, but I will think about why this problem occurs again, previously, this function was normal, and the only operation I did was to install it on Centos 6.5 recently. net core, and the result is now Centos 6.9. Is this problem caused by system upgrades?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.