The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

форумы  помощь  поиск  регистрация  майллист  вход/выход  слежка  RSS
"php'ные куралесены..."
Вариант для распечатки  
Пред. тема | След. тема 
Форумы OpenNET: Виртуальная конференция (Public)
Изначальное сообщение [ Отслеживать ]

"php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 30-Авг-09, 23:06 
Всем здравия и благополучия!
Проблемы с PHP, при заходе на сайт, в логах появляется:

ee /var/log/php-fpm.log


Aug 30 23:11:22.960921 [WARNING] 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 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Aug 30 23:11:22.961607 [NOTICE] fpm_children_bury(), line 194: child 596 stopped for tracing
Aug 30 23:11:22.961689 [NOTICE] fpm_php_trace(), line 139: about to trace 596
Aug 30 23:11:22.962430 [ERROR] fpm_trace_get_long(), line 69: ptrace(PT_IO) failed: Bad address (14)
Aug 30 23:11:22.980848 [NOTICE] 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" ?>
<configuration>

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

        <section name="global_options">

                Pid file
                <value name="pid_file">/var/run/php-fpm.pid</value>

                Error log file
                <value name="error_log">/var/log/php-fpm.log</value>

                Log level
                <value name="log_level">notice</value>

                When this amount of php processes exited with SIGSEGV or SIGBUS ...
                <value name="emergency_restart_threshold">10</value>

                ... 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.
                <value name="emergency_restart_interval">1m</value>

                Time limit on waiting child's reaction on signals from master
                <value name="process_control_timeout">5s</value>

                Set to 'no' to debug fpm
                <value name="daemonize">yes</value>

        </section>

        <workers>

                <section name="pool">

                        Name of pool. Used in logs and stats.
                        <value name="name">default</value>

                        Address to accept fastcgi requests on.
                        Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
                        <value name="listen_address">127.0.0.1:9000</value>

                        <value name="listen_options">

                                Set listen(2) backlog
                                <value name="backlog">-1</value>

                                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.
                                <value name="owner"></value>
                                <value name="group"></value>
                                <value name="mode">0666</value>
                        </value>

                        Additional php.ini defines, specific to this pool of workers.
                        <value name="php_defines">
                <!--            <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>            -->
                <!--            <value name="display_errors">0</value>                                                          -->
                        </value>

                        Unix user of processes
                        <value name="user">www</value>

                        Unix group of processes
                        <value name="group">www</value>

                        Process manager settings
                        <value name="pm">

                                Sets style of controling worker process count.
                                Valid values are 'static' and 'apache-like'
                                <value name="style">static</value>

                                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.
                                <value name="max_children">5</value>

                                Settings group for 'apache-like' pm style
                                <value name="apache_like">

                                        Sets the number of server processes created on startup.
                                        Used only when 'apache-like' pm_style is selected
                                        <value name="StartServers">20</value>

                                        Sets the desired minimum number of idle server processes.
                                        Used only when 'apache-like' pm_style is selected
                                        <value name="MinSpareServers">5</value>

                                        Sets the desired maximum number of idle server processes.
                                        Used only when 'apache-like' pm_style is selected
                                        <value name="MaxSpareServers">35</value>

                                </value>

                        </value>

                        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'
                        <value name="request_terminate_timeout">0s</value>

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

                        <value name="request_slowlog_timeout">5s</value>

                        The log file for slow requests
                        <value name="slowlog">/var/log/php-slow.log</value>

                        Set open file desc rlimit
                        <value name="rlimit_files">1024</value>

                        Set max core size rlimit
                        <value name="rlimit_core">0</value>

                        Chroot to this directory at the start, absolute path
                        <value name="chroot"></value>

                        Chdir to this directory at the start, absolute path
                        <value name="chdir"></value>

                        Redirect workers' stdout and stderr into main error log.
                        If not set, they will be redirected to /dev/null, according to FastCGI specs
                        <value name="catch_workers_output">yes</value>

                        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
                        <value name="max_requests">1500</value>

                        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.
                        <value name="allowed_clients">127.0.0.1</value>

                        Pass environment variables like LD_LIBRARY_PATH
                        All $VARIABLEs are taken from current environment
                        <value name="environment">
                                <value name="HOSTNAME">$HOSTNAME</value>
                                <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
                                <value name="TMP">/tmp</value>
                                <value name="TMPDIR">/tmp</value>
                                <value name="TEMP">/tmp</value>
                                <value name="OSTYPE">$OSTYPE</value>
                                <value name="MACHTYPE">$MACHTYPE</value>
                                <value name="MALLOC_CHECK_">2</value>
                        </value>

                </section>

        </workers>

</configuration>


ee /usr/local/etc/php.ini


[PHP]
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

[Syslog]
define_syslog_variables  = Off

[mail function]
SMTP = localhost
smtp_port = 25

[SQL]
sql.safe_mode = Off

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

[MySQL]
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]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1

[PostgresSQL]
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]
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

[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10

[bcmath]
bcmath.scale = 0

[Informix]
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]
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]
tidy.clean_output = Off

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

[Zend]
; 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@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


Высказать мнение | Ответить | Правка | Cообщить модератору

 Оглавление

Сообщения по теме [Сортировка по времени | RSS]


1. "php'ные куралесены..."  +/
Сообщение от ALex_hha (??) on 30-Авг-09, 23:22 
Зачем fpm используешь?
Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

2. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 31-Авг-09, 10:33 
>Зачем fpm используешь?

Настраивал сервер по руководству: http://www.lissyara.su/?id=1639

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

3. "php'ные куралесены..."  +/
Сообщение от ALex_hha (ok) on 31-Авг-09, 12:58 
>>Зачем fpm используешь?
>
>Настраивал сервер по руководству: http://www.lissyara.su/?id=1639

Я спрашивал зачем тебе fpm или шоб було?

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

4. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 31-Авг-09, 18:13 
>>>Зачем fpm используешь?
>>
>>Настраивал сервер по руководству: http://www.lissyara.su/?id=1639
>
>Я спрашивал зачем тебе fpm или шоб було?

Скорее всего что бы було.

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

5. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 31-Авг-09, 19:14 
Народ не проходите мимо....в чём же может быть дело?
Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

6. "php'ные куралесены..."  +/
Сообщение от GloryS (??) on 01-Сен-09, 11:38 
>Народ не проходите мимо....в чём же может быть дело?

А что тебе не нравится? У тебя же в конфиге стоит:

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

                        <value name="request_slowlog_timeout">5s</value>

Дальше бери свой скрипт и смотри, что там происходит....

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

7. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 01-Сен-09, 15:15 
>[оверквотинг удален]
>
> The timeout (in seconds) for serving of single request after which
>a php backtrace will be dumped to slow.log file
>            
>          
> '0s' means 'off'
>
>                        <value name="request_slowlog_timeout">5s</value>
>
>Дальше бери свой скрипт и смотри, что там происходит....

тут всё ок! )
ee  /usr/local/www/web1/index.php


<?php

/*
    This file is part of TorrentPier

    TorrentPier is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    TorrentPier is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    A copy of the GPL 2.0 should have been included with the program.
    If not, see http://www.gnu.org/licenses/

    Official SVN repository and contact information can be found at
    http://code.google.com/p/torrentpier/
*/

define('IN_PHPBB',   true);
define('BB_SCRIPT', 'index');
define('BB_ROOT', './');
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require(BB_ROOT ."common.$phpEx");

$page_cfg['load_tpl_vars'] = array(
    'post_icons',
);

$show_last_topic    = true;
$last_topic_max_len = 28;
$show_online_users  = true;
$show_subforums     = true;

$datastore->enqueue(array(
    'stats',
    'moderators',
));
if ($bb_cfg['show_latest_news'])
{
    $datastore->enqueue('latest_news');
}

// Init userdata
$user->session_start();

// Init main vars
$viewcat = isset($_GET['c']) ? (int) $_GET['c'] : 0;
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit'];

// Caching output
$req_page = 'index_page';
$req_page .= ($viewcat) ? "_c{$viewcat}" : '';

define('REQUESTED_PAGE', $req_page);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE .'_guest');

// Topics read tracks
$tracking_topics = get_tracks('topic');
$tracking_forums = get_tracks('forum');

// Statistics
$stats = $datastore->get('stats');

// Forums data
$forums = $datastore->get('cat_forums');
$cat_title_html = $forums['cat_title_html'];
$forum_name_html = $forums['forum_name_html'];

$anon = ANONYMOUS;
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
$only_new = $user->opt_js['only_new'];

// Validate requested category id
if ($viewcat AND !$viewcat =& $forums['c'][$viewcat]['cat_id'])
{
    redirect("index.$phpEx");
}
// Forums
$forums_join_sql = 'f.cat_id = c.cat_id';
$forums_join_sql .= ($viewcat) ? "
    AND f.cat_id = $viewcat
" : '';
$forums_join_sql .= ($excluded_forums_csv) ? "
    AND f.forum_id NOT IN($excluded_forums_csv)
    AND f.forum_parent NOT IN($excluded_forums_csv)
" : '';

// Posts
$posts_join_sql = "p.post_id = f.forum_last_post_id";
$posts_join_sql .= ($only_new == ONLY_NEW_POSTS) ? "
    AND p.post_time > $lastvisit
" : '';
$join_p_type = ($only_new == ONLY_NEW_POSTS) ? 'INNER JOIN' : 'LEFT JOIN';

// Topics
$topics_join_sql = "t.topic_last_post_id = p.post_id";
$topics_join_sql .= ($only_new == ONLY_NEW_TOPICS) ? "
    AND t.topic_time > $lastvisit
" : '';
$join_t_type = ($only_new == ONLY_NEW_TOPICS) ? 'INNER JOIN' : 'LEFT JOIN';

$sql = "
    SELECT SQL_CACHE
        f.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index,
        p.post_id AS last_post_id, p.post_time AS last_post_time,
        t.topic_id AS last_topic_id, t.topic_title AS last_topic_title,
        u.user_id AS last_post_user_id,
        IF(p.poster_id = $anon, p.post_username, u.username) AS last_post_username
    FROM       ". CATEGORIES_TABLE ." c
    INNER JOIN ". FORUMS_TABLE     ." f ON($forums_join_sql)
    $join_p_type ". POSTS_TABLE      ." p ON($posts_join_sql)
    $join_t_type ". TOPICS_TABLE     ." t ON($topics_join_sql)
     LEFT JOIN ". USERS_TABLE      ." u ON(u.user_id = p.poster_id)
    ORDER BY c.cat_order, f.forum_order
";
$cat_forums = array();

$replace_in_parent = array(
    'last_post_id',
    'last_post_time',
    'last_post_user_id',
    'last_post_username',
    'last_topic_title',
    'last_topic_id',
);

foreach ($db->fetch_rowset($sql) as $row)
{
    if (!$cat_id = $row['cat_id'] OR !$forum_id = $row['forum_id'])
    {
        continue;
    }

    if ($parent_id = $row['forum_parent'])
    {
        if (!$parent =& $cat_forums[$cat_id]['f'][$parent_id])
        {
            $parent = $forums['f'][$parent_id];
            $parent['last_post_time'] = 0;
        }
        if ($row['last_post_time'] > $parent['last_post_time'])
        {
            foreach ($replace_in_parent as $key)
            {
                $parent[$key] = $row[$key];
            }
        }
        if ($show_subforums && $row['show_on_index'])
        {
            $parent['last_sf_id'] = $forum_id;
        }
        else
        {
            continue;
        }
    }
    else
    {
        $f =& $forums['f'][$forum_id];
        $row['forum_desc']   = $f['forum_desc'];
        $row['forum_posts']  = $f['forum_posts'];
        $row['forum_topics'] = $f['forum_topics'];
    }

    $cat_forums[$cat_id]['f'][$forum_id] = $row;
}
unset($forums);
$datastore->rm('cat_forums');

// Obtain list of moderators
$moderators = array();
$mod = $datastore->get('moderators');

foreach ($mod['mod_users'] as $forum_id => $user_ids)
{
    foreach ($user_ids as $user_id)
    {
        $moderators[$forum_id][] = '<a href="'. (PROFILE_URL . $user_id) .'">'. $mod['name_users'][$user_id] .'</a>';
    }
}
foreach ($mod['mod_groups'] as $forum_id => $group_ids)
{
    foreach ($group_ids as $group_id)
    {
        $moderators[$forum_id][] = '<a href="'. (GROUP_URL . $group_id) .'">'. $mod['name_groups'][$group_id] .'</a>';
    }
}

unset($mod);
$datastore->rm('moderators');

if (!$forums_count = count($cat_forums) AND $viewcat)
{
    redirect("index.$phpEx");
}

$template->assign_vars(array(
    'SHOW_FORUMS'           => $forums_count,
    'PAGE_TITLE'            => $lang['Index'],
    'NO_FORUMS_MSG'         => ($only_new) ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'],

    'TOTAL_TOPICS'          => sprintf($lang['Posted_topics_total'], $stats['topiccount']),
    'TOTAL_POSTS'           => sprintf($lang['Posted_articles_total'], $stats['postcount']),
    'TOTAL_USERS'           => sprintf($lang['Registered_users_total'], $stats['usercount']),
    'NEWEST_USER'           => sprintf($lang['Newest_user'], '<a href="'. PROFILE_URL . $stats['newestuser']['user_id'] .'">', $stats['newestuser']['username'], '</a>'),

    // Tracker stats
    'TORRENTS_STAT'         => sprintf($lang['Torrents_stat'], $stats['torrentcount'], humn_size($stats['size'])),
    'PEERS_STAT'            => sprintf($lang['Peers_stat'], $stats['peers'], $stats['seeders'], $stats['leechers']),
    'SPEED_STAT'            => sprintf($lang['Speed_stat'], humn_size($stats['speed']) .'/s'),

    'FORUM_IMG'             => $images['forum'],
    'FORUM_NEW_IMG'         => $images['forum_new'],
    'FORUM_LOCKED_IMG'      => $images['forum_locked'],

    'SHOW_ONLY_NEW_MENU'    => true,
    'ONLY_NEW_POSTS_ON'     => ($only_new == ONLY_NEW_POSTS),
    'ONLY_NEW_TOPICS_ON'    => ($only_new == ONLY_NEW_TOPICS),

    'U_SEARCH_NEW'          => "search.$phpEx?new=1",
    'U_SEARCH_SELF_BY_MY'   => "search.$phpEx?uid={$userdata['user_id']}&o=1",
    'U_SEARCH_LATEST'       => "search.$phpEx?search_id=latest",
    'U_SEARCH_UNANSWERED'   => "search.$phpEx?search_id=unanswered",

    'SHOW_LAST_TOPIC'       => $show_last_topic,
));

// Build index page
foreach ($cat_forums as $cid => $c)
{
    $template->assign_block_vars('c', array(
        'CAT_ID'    => $cid,
        'CAT_TITLE' => $cat_title_html[$cid],
        'U_VIEWCAT' => "index.$phpEx?c=$cid",
    ));

    foreach ($c['f'] as $fid => $f)
    {
        if (!$fname_html =& $forum_name_html[$fid])
        {
            continue;
        }
        $is_sf = $f['forum_parent'];

        $new = is_unread($f['last_post_time'], $f['last_topic_id'], $f['forum_id']) ? '_new' : '';
        $folder_image = ($is_sf) ? $images["icon_minipost{$new}"] : $images["forum{$new}"];

        if ($f['forum_status'] == FORUM_LOCKED)
        {
            $folder_image = ($is_sf) ? $images['icon_minipost'] : $images['forum_locked'];
        }

        if ($is_sf)
        {
            $template->assign_block_vars('c.f.sf', array(
                'SF_ID'   => $fid,
                'SF_NAME' => $fname_html,
                'SF_NEW'  => $new ? ' new' : '',
            ));
            continue;
        }

        $template->assign_block_vars('c.f',    array(
            'FORUM_FOLDER_IMG' => $folder_image,

            'FORUM_ID'   => $fid,
            'FORUM_NAME' => $fname_html,
            'FORUM_DESC' => $f['forum_desc'],
            'POSTS'      => commify($f['forum_posts']),
            'TOPICS'     => commify($f['forum_topics']),
            'LAST_SF_ID' => isset($f['last_sf_id']) ? $f['last_sf_id'] : null,

            'MODERATORS'  => isset($moderators[$fid]) ? join(', ', $moderators[$fid]) : '',
            'FORUM_FOLDER_ALT' => ($new) ? 'new' : 'old',
        ));

        if ($f['last_post_id'])
        {
            $template->assign_block_vars('c.f.last', array(
                'LAST_TOPIC_ID'       => $f['last_topic_id'],
                'LAST_TOPIC_TIP'      => $f['last_topic_title'],
                'LAST_TOPIC_TITLE'    => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),

                'LAST_POST_TIME'      => create_date($bb_cfg['last_post_date_format'], $f['last_post_time']),
                'LAST_POST_USER_ID'   => ($f['last_post_user_id'] != ANONYMOUS) ? $f['last_post_user_id'] : false,
                'LAST_POST_USER_NAME' => ($f['last_post_username']) ? str_short($f['last_post_username'], 15) : $lang['Guest'],
            ));
        }
    }
}

// Set tpl vars for bt_userdata
if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST)
{
    show_bt_userdata($userdata['user_id']);
}

// Latest news
if ($bb_cfg['show_latest_news'])
{
    $latest_news = $datastore->get('latest_news');

    $template->assign_vars(array(
        'SHOW_LATEST_NEWS' => true,
    ));

    foreach ($latest_news as $news)
    {
        $template->assign_block_vars('news', array(
            'NEWS_TOPIC_ID' => $news['topic_id'],
            'NEWS_TITLE'    => $news['topic_title'],
            'NEWS_TIME'     => create_date('d-M', $news['topic_time']),
            'NEWS_IS_NEW'   => $news['topic_time'] > $lastvisit,
        ));
    }
}
// Allow cron
if (IS_ADMIN || IS_MOD)
{
    if (@file_exists(CRON_RUNNING)) {
        if (@file_exists(CRON_ALLOWED))
        {
            unlink (CRON_ALLOWED);
        }
        rename(CRON_RUNNING, CRON_ALLOWED);
    }
}

// Display page
define('SHOW_ONLINE', $show_online_users);

print_page('index.tpl');


Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

8. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 01-Сен-09, 15:16 
- Сделал релиз через сокеты
- Тестировал на 2 ПК
- удалил eAccelerator
- железо Celeron1000, 512RAM (на серверее я один...)

Судя по логам всё то же самое, сайт так же грузиться ~30 Секунд

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

9. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 01-Сен-09, 15:45 
После смены интервала с 5s на 60s
появилось следующее:
Sep 01 16:37:15.760002 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:7207, cur:7207
Sep 01 16:37:15.798769 [NOTICE] fpm_event_init_main(), line 88: libevent: using kqueue
Sep 01 16:37:15.799337 [NOTICE] fpm_init(), line 52: fpm is running, pid 595
Sep 01 16:37:15.908277 [NOTICE] fpm_children_make(), line 352: child 599 (pool default) started
Sep 01 16:37:15.912196 [NOTICE] fpm_children_make(), line 352: child 614 (pool default) started
Sep 01 16:37:15.922960 [NOTICE] fpm_children_make(), line 352: child 615 (pool default) started
Sep 01 16:37:15.926873 [NOTICE] fpm_children_make(), line 352: child 616 (pool default) started
Sep 01 16:37:15.930914 [NOTICE] fpm_children_make(), line 352: child 617 (pool default) started
Sep 01 16:37:15.931565 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

10. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 01-Сен-09, 16:26 
GZIP OFF
[  Execution time: 16,326 sec  |  MySQL: 26 queries |  GZIP OFF  |  Mem: 459,51 KB / 2,97 MB / 2,45 MB  |  Load: 0 0 0  ]

GZIP ON
[  Execution time: 28,326 sec  |  MySQL: 26 queries |  GZIP OFF  |  Mem: 459,51 KB / 2,97 MB / 2,45 MB  |  Load: 0 0 0  ]

хм...где ещё сoбака зарыта....

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

11. "php'ные куралесены..."  +/
Сообщение от xolodru (ok) on 01-Сен-09, 20:26 
И так, лазутчик найден.....
[  Execution time: 31,804 sec  |  MySQL: 75 queries |  GZIP OFF  |  Mem: 459,54 KB / 3 MB / 2,49 MB  |  Load: 1 0,3 0,1  ]
дело в том, что когда кол-во запросов в MySQL ~75 queries, то время загрузки начальной страницы 31,804 sec


ee /etc/my.cnf


# Опции для всех клиентов MySQL
[client]
# Пароль для подключения к БД
#password       = your_password
# Порт на котором висит MySQL
port            = 3306
# Сокет MySQL
socket          = /tmp/mysql.sock


# Опции MySQL-сервера
[mysqld]
log-slow-queries = /var/log/mysql-slow.log
#т.е. лог для запросов > 1 минуты..................у меня пусто!
long_query_time = 1


# Порт
port            = 3306
# Адрес, который будем слушать (если вам не нужно подключаться к
# MySQL с других машин, то оставьте здесь 127.0.0.1)
bind-address    = 127.0.0.1
# Где лежит сокет
socket          = /tmp/mysql.sock
# Не использовать средства системных блокировок.
skip-locking
#
#Расчет идет из 1/4 от оперативки,но не больше 1/2 иначе будут
#скидыватся на жесткий временные файлы, что повлечет снижение
#производительности
key_buffer = 256K
# Максимальный размер одного пакета
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-networking
skip-innodb
skip-bdb
server-id       = 1
#Логи
# Файл должен существовать, с соответствующими правами на него:
# touch /var/log/mysql.log
# chown mysql:wheel /var/log/mysql.log
# chmod 640 /var/log/mysql.log
log            = /var/log/mysql.log
[mysqldump]
# Если задан этот параметр, то обработчик таблицы при выполнении
# удаления не будет объединять индексы - в некоторых случаях это
# может ускорить данную операцию
quick
# Максимальная величина пакета, посылаемого/принимаемого с сервера
max_allowed_packet = 16M

[mysql]
# Отключает автоматическое рехеширование. rehash следует использовать
# для получения хеша таблиц и полей. Это обеспечивает более
# быстрый старт mysql.
no-auto-rehash
# Опция, которую рекомендуется раскомментить начинающим :)
# Разрешает выполнять только операции UPDATE и DELETE, используя ключи.
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
# Допускать простой длительностью interactive_timeout секунд (вместо
# wait_timeout секунд) перед закрытием данного соединения.
interactive-timeout

где теперь баг?

Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору

Архив | Удалить

Индекс форумов | Темы | Пред. тема | След. тема




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру