Dancing with a tambourine - "PHP"

gloomen nginx-forum at nginx.us
Sun Aug 30 23:19:37 MSD 2009


Hi all! 
Problems with PHP, when approaching the site, appears in the logs:

ee /var/log/php-fpm.log

Aug 30 23:11:22.960921  fpm_request_check_timed_out(), line 146: child 596, script '/usr/local/www/web1/index.php' (pool default) executing too slow (5.069391 sec), logg
Aug 30 23:11:22.961224  fpm_got_signal(), line 48: received SIGCHLD
Aug 30 23:11:22.961607  fpm_children_bury(), line 194: child 596 stopped for tracing
Aug 30 23:11:22.961689  fpm_php_trace(), line 139: about to trace 596
Aug 30 23:11:22.962430  fpm_trace_get_long(), line 69: ptrace(PT_IO) failed: Bad address (14)
Aug 30 23:11:22.980848  fpm_php_trace(), line 167: finished trace of 596


ee /usr/local/etc/nginx/nginx.conf

user  www;
worker_processes  3;

pid        /var/run/nginx.pid;
worker_rlimit_nofile  1000;

events {
    worker_connections  2000;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    tcp_nopush     on;
    tcp_nodelay    on;
    keepalive_timeout  65;
    server_names_hash_max_size 2048;
    server_names_hash_bucket_size 128;

    sendfile on;
    gzip  on;

    gzip_min_length 2048;
    gzip_types text/css text/js text/xml;

    client_max_body_size 10m;
    large_client_header_buffers 4 8k;

    log_format main      '$remote_addr - $remote_user [$time_local] '
                         '"$request"'
                         '"$http_referer" "$http_user_agent" "$gzip_ratio"';


    server {
        listen       80;
        server_name mysite.com;
        access_log   /var/log/nginx.access_log  main;

        charset windows-1251;
        client_max_body_size    25m;

        location / {
            root   /usr/local/www/web1;
            index  index.html index.php;
        }

        location ~* \.php$ {
            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            fastcgi_read_timeout 180;
            fastcgi_buffer_size 1024k;
            fastcgi_buffers 4 1024k;
            fastcgi_busy_buffers_size 1024k;
            fastcgi_temp_file_write_size 1024k;
            fastcgi_temp_path /tmp;

            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME /usr/local/www/web1$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}


ee /usr/local/etc/php-fpm.conf

<?xml version="1.0" ?>


        All relative paths in this config are relative to php's install prefix

        

                Pid file
                /var/run/php-fpm.pid

                Error log file
                /var/log/php-fpm.log

                Log level
                notice

                When this amount of php processes exited with SIGSEGV or SIGBUS ...
                10

                ... in a less than this interval of time, a graceful restart will be initiated.
                Useful to work around accidental curruptions in accelerator's shared memory.
                1m

                Time limit on waiting child's reaction on signals from master
                5s

                Set to 'no' to debug fpm
                yes

        

        

                

                        Name of pool. Used in logs and stats.
                        default

                        Address to accept fastcgi requests on.
                        Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
                        127.0.0.1:9000

                        

                                Set listen(2) backlog
                                -1

                                Set permissions for unix socket, if one used.
                                In Linux read/write permissions must be set in order to allow connections from web server.
                                Many BSD-derrived systems allow connections regardless of permissions.
                                
                                
                                0666
                        

                        Additional php.ini defines, specific to this pool of workers.
                        
                <!--            /usr/sbin/sendmail -t -i            -->
                <!--            0                                                          -->
                        

                        Unix user of processes
                        www

                        Unix group of processes
                        www

                        Process manager settings
                        

                                Sets style of controling worker process count.
                                Valid values are 'static' and 'apache-like'
                                static

                                Sets the limit on the number of simultaneous requests that will be served.
                                Equivalent to Apache MaxClients directive.
                                Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
                                Used with any pm_style.
                                5

                                Settings group for 'apache-like' pm style
                                

                                        Sets the number of server processes created on startup.
                                        Used only when 'apache-like' pm_style is selected
                                        20

                                        Sets the desired minimum number of idle server processes.
                                        Used only when 'apache-like' pm_style is selected
                                        5

                                        Sets the desired maximum number of idle server processes.
                                        Used only when 'apache-like' pm_style is selected
                                        35

                                

                        

                        The timeout (in seconds) for serving a single request after which the worker process will be terminated
                        Should be used when 'max_execution_time' ini option does not stop script execution for some reason
                        '0s' means 'off'
                        0s

                        The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
                        '0s' means 'off'

                        5s

                        The log file for slow requests
                        /var/log/php-slow.log

                        Set open file desc rlimit
                        1024

                        Set max core size rlimit
                        0

                        Chroot to this directory at the start, absolute path
                        

                        Chdir to this directory at the start, absolute path
                        

                        Redirect workers' stdout and stderr into main error log.
                        If not set, they will be redirected to /dev/null, according to FastCGI specs
                        yes

                        How much requests each process should execute before respawn.
                        Useful to work around memory leaks in 3rd party libraries.
                        For endless request processing please specify 0
                        Equivalent to PHP_FCGI_MAX_REQUESTS
                        1500

                        Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
                        Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
                        Makes sense only with AF_INET listening socket.
                        127.0.0.1

                        Pass environment variables like LD_LIBRARY_PATH
                        All $VARIABLEs are taken from current environment
                        
                                $HOSTNAME
                                /usr/local/bin:/usr/bin:/bin
                                /tmp
                                /tmp
                                /tmp
                                $OSTYPE
                                $MACHTYPE
                                2
                        

                

        





ee /usr/local/etc/php.ini


engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision    =  14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 60
max_input_time = 60
memory_limit = 48M		; увеличиваем лимит по памяти для "тяжелых" скриптов
error_reporting  =  E_ALL & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024	;размер лога
ignore_repeated_errors = On
ignore_repeated_source = On
report_memleaks = On
track_errors = On
variables_order = "EGPCS"
register_globals = off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 12M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = On
file_uploads = On
upload_max_filesize = 8M
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60


define_syslog_variables  = Off


SMTP = localhost
smtp_port = 25


sql.safe_mode = Off


odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1


mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off


mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off


msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1


pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0


sybase.allow_persistent = On
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off


sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10


bcmath.scale = 0


ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = On
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0


session.save_handler = files
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 1000
session.gc_maxlifetime = 256000
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 18000
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"


tidy.clean_output = Off


soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400


; eAccelerator
zend_extension="/usr/local/lib/php/20060613/eaccelerator.so"
eaccelerator.enable="1"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"



root# uname -a
FreeBSD 6.4-RELEASE root at dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  i386

root# php -v
PHP 5.2.10 with Suhosin-Patch 0.9.7 (cli) (built: Aug 26 2009 20:59:41)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

root# php-cgi -v
PHP 5.2.10 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Aug 26 2009 20:59:11)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator


Posted at Nginx Forum: http://forum.nginx.org/read.php?2,5359,5359#msg-5359






More information about the nginx mailing list