Saturday, December 19, 2009

PHP APC crashes APACHE (APC de PHP traba apache)

Escribiré este post en dos idiomas para que realmente pueda ayudar. (English below)

Actualmente estoy trabajando con la migración de un sitio choncho de un VPS a otro. Este sitio requiere dos extensiones de PHP adicionales, Memcache y APC.

Todo iba funcionando perfectamente hasta que instalé APC. Al intentar ver un archivo en PHP, este se abria correctamente una sola vez, al segundo intento no me devolvia nada. Exploré el archivo de errores de Apache para encontrarme que un proceso hijo había terminado por una falta de segmento. Imediatamente supe que era por APC.

Despues de bajar y recompilar casi 15 versiones de APC sin exito y cambiar todas las opciones de APC, tambien sin exito, me puse a indagar en internet durante mucho tiempo, sin ninguna ayuda, hasta que por error di con un post del ZEND Optimizer que no tenia nada que ver y eso me dio una idea: Deshabilitar ZEND.

Problema:
Apache envia error SEG FAULT (11) al ejecutar scripts de PHP con APC

Escenario:
PHP 5.2.10, Apache 2.2.11, WHM/cPanel, CentOS 5.3, APC 3.0.19, Memcache 1.1, ZEND 3.3.3

Solución:
Deshabilitar Zend Optimizer en php.ini

---------------------------------------------
English:


Right now I'm migrating a very huge site from a VPS to another. This site requires two additional PHP extensions to work as expected: APC & Memcache.

Everything was going just as expected until i compiled and installed APC. When trying to run a PHP script, it was shown correctly only once; for the second try it just showed a blank screen. Immediatly I gave a look into the Apache's error log file to see what the problem was; at the last line, it read something about a Seg(ment) fault (11), for sure i knew it was because of APC.

After downloading and recompiling 15 (yes, 15!!) APC versions and changing every APC runtime option without succes, i googled for help... after about an hour of browsing lots of sites without any hint that may get me out of the problem, i found (by mistake) a post about ZEND optimizer that had nothing to do with the APC issue, but that give me an idea... it could be because of ZEND!

Problem:
Apache crashes a child process with SEG FAULT (11) when running a PHP script with APC.

Scenario:
PHP 5.2.10, Apache 2.2.11, WHM/cPanel, CentOS 5.3, APC 3.0.19, Memcache 1.1, ZEND 3.3.3

Solution:
Disable ZEND Optimizer extensions in php.ini