1

我的 Symfony 缓存有问题。当我使用 Apache 和 Nginx PHP-FPM 测试同一个项目(在开发环境中)时。Apache 快 10 倍。(4900 毫秒与 500 毫秒)

我在几个进程上做了一些“strace”,我已经看到 Apache Symfony 关心缓存。但是使用 Nginx/FPM,Symfony 似乎可以执行所有代码。(不使用应用程序缓存)

symfony 在 Apache 而不是 Nginx 中使用正确的缓存有什么不同?

或者,在 DEV 环境中是否有一些与 Nginx/FPM 相关的特殊配置?

谢谢

= NGINX 配置 =

location / { 
    index app.php;
    if (-f $request_filename) {
        break;
    }   
    rewrite ^(.*)$ /app.php last;
}
location ~ (app|app_dev).php {
    include /etc/nginx/nginx-fpm.conf;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param HTTPS off;
}

= /etc/nginx/nginx-fpm.conf ==

fastcgi_pass   unix:/tmp/php-fpm.sock;
fastcgi_index  index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        80;
fastcgi_param  SERVER_NAME        $server_name;
fastcgi_param  REDIRECT_STATUS    200;

== PHP-FPM ==

[global]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
include=/etc/php5/fpm/pool.d/*.conf

= /etc/php5/fpm/pool.d/www.conf =

[www]
user = www-data
group = www-data
listen = /tmp/php-fpm.sock
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.status_path = /status
access.log = /var/log/fpm/www.access.log
access.format = %R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%%
chdir = /

== APC ==

extension=apc.so
apc.shm_segments=1
apc.shm_size=512M
apc.enable_cli=1
apc.include_once_override=1
apc.canonicalize=1
apc.stat="0" ; OR 1 it's the same result

== 其他扩展 ==

apc.ini
curl.ini
gd.ini
imagick.ini
intl.ini
memcached.ini
memcache.ini
mysqli.ini
mysql.ini
pdo.ini
pdo_mysql.ini
pdo_sqlite.ini
sqlite3.ini
sqlite.ini
4

0 回答 0