Welcome! Log In Create A New Profile

Advanced

php-fpm breaks my CakePHP APP ?

Posted by balrog2000 
php-fpm breaks my CakePHP APP ?
October 26, 2009 09:30AM
Hello Bakers,

I have a quite weird problem. Wasted several hours on this already.
I am migrating from apache 2.2 + mod_php to a nginx + php_fpm.

Generally, application is working fine under both of them (they now
point to the same rootdir, however i can fire apache or nginx by
selecting port i.e. myapp.com:81, myapp.com:82)

Under apache everything is fine.

Under nginx my Session->flash messages doesnt ever disappear, means
the session flash is not cleared after displaying.

When running in debug mode I have 2 errors at the bottom, written even
after $cakeDebug:

[b]( ! ) Fatal error: Class 'Cache' not found in Unknown on line 0
( ! ) Fatal error: Class 'CakeSession' not found in Unknown on line 0[/b]

What does it mean? Anyone ever encountered such? I have triple cleared
all the caches, even switched from fileengine to memcache... still no
luck... xdebug doesnt show anything more either

I am using regular nginx conf for this

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root
$fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_param SERVER_NAME $host;
}

The problem seems to be somewhere when application is finishing.


Problem originates from libs/session.php.
This instruction:

session_set_save_handler( array('CakeSession','__open'),
array('CakeSession', '__close'),
array('Cache', 'read'),
array('Cache', 'write'),
array('Cache', 'delete'),
array('Cache', 'gc')
);

How to fix?


Is there an possibility that php-fpm changes workdirs so that PHP cant find those classes??
Gordon Pettey
Re: php-fpm breaks my CakePHP APP ?
October 26, 2009 12:00PM
Works fine for me with Cake 1.2 and 1.3, PHP 5.2.11 with the php-fpm
0.5-php-5.2.10 patch applied, nginx 0.8.17.

My config:

server {
listen i.hid.my.ip;
server_name somedomain.com;

access_log /home/me/logs/somedomain.access main;
error_log /home/me/logs/somedomain.error info;

root /home/me/somedomain/webroot;

index index.php;

location / {
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?url=$1 last;
break;
}
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}

Get rid of fastcgi_param SERVER_NAME $host. First, it should be
$server_name, not $host. Second, it is already set in fastcgi_params
file. You need fastcgi_intercept_errors off if you want Cake to
display "controller/view not found" pages.
hk
Re: php-fpm breaks my CakePHP APP ?
January 12, 2010 09:36AM
Hello Balrog,

I am facing the same problem. Were you able to resolve this above issue?

Thanks,
HK
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 275
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready