升级 PHP,现在 Phalcon / Nginx 不再有效

Upgrade PHP, now Phalcon / Nginx no longer works

从 PHP 5.3 升级到 PHP 5.4,现在,服务器上的所有 Phalcon 站点都会出现 502 错误。

盒子信息: 森托斯 6.5 PHP 5.4 nginx 1.6 Phalcon 2.0

错误信息: 浏览器显示:

502 Bad Gateway

Nginx 日志:

[error] 27662#0: *6 recv() failed (104: Connection reset by peer) while reading response header from upstream

PHP-FPM 日志:

WARNING: [pool www] child 27667 exited on signal 4 (SIGILL) after 272.690790 seconds from start

nginx 和 php-fpm 已重启无数次。 Phalcon 已重装无数次。

PHP-FPM 会议:

include=/etc/php-fpm.d/*.conf
pid = /var/run/php-fpm/php-fpm.pid

PHP-FPM www.conf

listen = /var/run/php5-fpm.sock
listen.owner = nginx
listen.group = nginx
user = nginx;
group = nginx;
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500
security.limit_extensions = false
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session

session 路径已经过权限和所有权检查,所以没问题。

Nginx 会议:

server {
listen      IPADDR:80;
server_name sub.domain.com;

index index.php index.html index.htm;
set $root_path '/var/www/projectname/public';
root $root_path;

location / {
    try_files $uri $uri/ @php_mvc;
}

location @php_mvc {
    rewrite ^(.+)$ /index.php last;
}

location ~ ^(.+\.php)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.php)(/.*)?$;

    set $script_filename $document_root$fastcgi_script_name;

    if (!-e $script_filename) {
        return 404;
    }

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

    fastcgi_param   APPLICATION_ENV development;
    fastcgi_param   SCRIPT_FILENAME $script_filename;
    fastcgi_param   SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param   PATH_INFO $fastcgi_path_info;
}

location ~* ^/(css|img|js|flv|swf|download|images)/(.+)$ {
    root $root_path;
}
}

非常感谢任何帮助!

好的,我终于在 Phalcon 的 github 问题列表中找到了答案。

这个post: Phalcon Github issue 2593

解决方案是删除我所有的 phalcon 代码,然后通过以下方式手动重新编译:

cd build/64bits
phpize
export CFLAGS="-O2 -g"
./configure 
make
sudo make install

我还 git 克隆了该源的新版本以确保。删除以前的代码对我来说更多的是确保它没有获取任何缓存的配置。希望这可以帮助其他人节省几个小时!