Here are the steps you can do, to track down this error.
Some simple tips to start
- Use a debugger like ZendDebugger or XDebug to find the line of code causing the error.
- Disable PHP's internal garbage collector. The garbage collector is known to often cause segmentation faults. If disabling will help you are probably found an internal reference counting bug in the garbage collector
ini_set('zend.enable_gc', 0);- Look for recursion in your code. PHP throws a segmentation fault if you have a infinite recursion in your code
- If you have apc installed sometimes it helps to empty the cache or disable the cache
Use strace
If php runs on Linux or Mac OS you can use strace/dtruss to hook into the process and see what's happening. Strace can be installed on Debian by running
apt-get install strace
Run phpunit with strace
$ strace phpunit
Attach strace to a already running process
$ sudo strace -s 256 -p <PID>
Run any php script with strace
$ strace php index.php
Attach strace to a running cgi process
$ ps axf | grep php5-cgi # lists all running processes #If more than one process is found you can use the tool php-strace (see below) to trace all processes at the same time. If only one process is found you can use the following command to trace: $ sudo strace -s 256 -p <PID> #For debugging purposes I recommend to limit the cgi processes running to one, so you can be sure to hook into the right process which is serving your browser. # The number of running cgi processes can be edited by editing the file /etc/php5/fpm/pool.d/www.conf .
Gdb
Also you can try to run the script inside of gdb. On Debian gdb can be installed using the command "apt-get install gdb"
gdb --args php /usr/bin/phpunit #inside gdb enter: set env MALLOC_CHECK_=3 #then enter: r
php-strace
I wrote a tool for easy monitoring running cgi proccesses on a server or a developer box.
php-strace helps to track down segfaults in running php processes. It starts a new strace instance for every running php5-cgi or php-fpm process to monitor whether a segfault happened.
To get started, visit my github page. https://github.com/markus-perl/php-strace
Update
php-strace V0.3 available:https://dl.dropboxusercontent.com/u/32252351/github/php-strace-0.3.tar.gz
Haha, google sent me here because of a segmentation fault in php-fpm when using xdebug, first tip is "use xdebug". I guess its fml then. ;-)
AntwortenLöschenSaved my day! Thank you!
AntwortenLöschenThank you so much for this blog post, I have been searching Google from few days and nothing worked. You saved my days. Thanks a lot!
AntwortenLöschenHello, I read your blog occasionally, and I own a similar one, and I was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me insane, so any assistance is very much appreciated.
AntwortenLöschenAndroid Course Training in Chennai | No.1 Android Training in Chennai
Data Science Course Training in Chennai | Best Data Science Training in Chennai
Matlab Training in Chennai | Best Matlab Course Training in Chennai
AWS Training in Chennai | No.1 AWS Training in Chennai
Selenium Course Training in Chennai | Best Selenium Training in chennai
Devops Course Training in Chennai | Best Devops Training in Chennai
Data science Course Training in Chennai | No.1 Data Science Training in Chennai
RPA Course Training in Chennai | No.1 RPA Training in Chennai
AWS Course Training in Chennai | No.1 AWS Training in Chennai
Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
AntwortenLöschenBest PHP Training Institute in Chennai|PHP Course in chennai
Best .Net Training Institute in Chennai
Software Testing Training in Chennai
Blue Prism Training in Chennai
Angularjs Training in Chennai
Thanks for the Incredible Blogs about JAVA...Appreciated for your Efforts.To explore more about JAVA Visit here
AntwortenLöschenJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
Dieser Kommentar wurde vom Autor entfernt.
AntwortenLöschenAwesome Post. It was a pleasure reading your article. Thanks for sharing.Software Testing Training in Chennai
AntwortenLöschenSoftware Testing Training in Velachery
Software Testing Training in Tambaram
Software Testing Training in Porur
Software Testing Training in Omr
Software Testing Training in Annanagar
It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
AntwortenLöschenDigital Marketing Training in Chennai
Digital Marketing Training in Velachery
Digital Marketing Training in Tambaram
Digital Marketing Training in Porur
Digital Marketing Training in Omr
Digital Marketing Training in Annanagar