Solution to php script segmentation error: 1. Upgrade the PHP version; 2. Delete the "/etc/pki/nssdb/pkcs11.txt" and "/etc/pki/nssdb/cert9.db" files. Can.
Recommended: "PHP Video Tutorial"
PHP uses file_get_contents or curl to request https domain names. A segment fault error will occur.
The problem PHP code is as follows. A segment fault will occur when executing this PHP command:
var_dump(file_get_contents("https://www.baidu.com"));
Solution:
1. Upgrade your PHP version, In the 5.4 environment, the problem cannot be reproduced (the above execution code is PHP5.2)
2. Sadly, this has not been the case. Removing /etc/pki/nssdb/pkcs11.txt and / etc/pki/nssdb/cert9.db seem to be the key, here. :-((The solution provided on Centos bugs is feasible after practice, but it will reappear soon after deleting it)
But Why does a segmentation fault occur?
PHP version:
PHP 5.2.14 (cli) (built: Jul 3 2016 23:56:15) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator
Linux system information:
LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.3 (Final) Release: 6.3 Codename: Final
By checking the kernel log and gdb record, you can find that the problem occurs on libsqlite
Kernel log:
tail -f /var/log/messages kernel: php[26564]: segfault at 8048 ip 00007f7a72fede9c sp 00007fffec90edf0 error 4 in libsqlite3.so.0.8.6[7f7a72fd1000+8c000]
gdb record:
Program received signal SIGSEGV, Segmentation fault. 0x00007fffe9651e9c in sqlite3_file_control () from /usr/lib64/libsqlite3.so.0
In the Centos bug list, you can find a description of this bug:
https://bugs.centos.org/view.php?id=7399 https://www.mankier.com/5/cert9.db
The above is the detailed content of How to solve the problem of php script segmentation error. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
