{"id":505003,"date":"2026-11-27T07:43:11","date_gmt":"2026-11-27T04:43:11","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=505003"},"modified":"2026-11-27T07:43:11","modified_gmt":"2026-11-27T04:43:11","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=505003","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0434\u0438\u043e \u00ab\u041c\u0443\u0445\u043e\u043c\u043e\u0440 \u0421\u041f\u0431\u00bb \u043d\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0434\u043e\u043c\u0435\u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u044f\u0434\u0440\u0430 \u0441\u0432\u043e\u0435\u0439 flat-file CMS"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u0435\u0440\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 \u0434\u0435\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 CMS \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c PHP \u0431\u0435\u0437 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432\u0441\u044f \u00ab\u0431\u0430\u0437\u0430\u00bb \u043b\u0435\u0436\u0438\u0442 \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 JSON-\u0444\u0430\u0439\u043b\u0430\u0445). \u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0441\u0430\u0439\u0442\u0430 \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u00ab\u043f\u043b\u0430\u043d\u0435\u0442\u0430\u00bb \u0432 \u043e\u0431\u0449\u0435\u0439 \u0441\u0435\u0442\u0438, \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u0430\u044f P2P-\u043f\u043e\u0447\u0442\u0430 \u043d\u0430 cURL, \u043e\u0431\u043c\u0435\u043d \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430\u043c\u0438 \u0438 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0434\u0438\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u0432\u0438\u0442\u044c \u044d\u0444\u0438\u0440 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0441\u0435\u0442\u0438.<\/p>\n<p>\u042f \u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0441\u044f \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430: \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u043d\u0430\u044f \u0442\u0438\u0448\u0438\u043d\u0430, \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435 \u00ab\u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c WordPress\u00bb. \u041d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0432\u0451\u043b \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u0435\u0432\u043e\u0439 \u0442\u0435\u0441\u0442.<\/p>\n<p>\u0412 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043b\u0430\u043d\u0435\u0442 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0441 \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>\u00ab\u041c\u0443\u0445\u043e\u043c\u043e\u0440 \u0421\u041f\u0431\u00bb<\/strong>, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0434\u043e\u043c\u0435\u043d\u0443 <code>pigcms.\u0440\u0443<\/code>. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0435\u0451 \u0432\u043e\u043b\u043d\u0443 \u0432 \u0440\u0430\u0434\u0438\u043e\u043f\u043b\u0435\u0435\u0440\u0435 \u0432\u044b\u043b\u0435\u0442\u0430\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u2014 \u044d\u0444\u0438\u0440\u0430 \u0442\u0430\u043c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u00ab\u043d\u0430\u043c\u0451\u043a\u00bb \u043e\u0442 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u041f\u0438\u0442\u0435\u0440\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043b\u0443\u0447\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u0442\u0430. \u0421\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043f\u043b\u0430\u043d\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0432\u0435\u0440\u0447\u0438\u0432 (\u0442\u0443 \u043b\u0430\u0437\u0435\u0439\u043a\u0443 \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043a\u0440\u044b\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 DNS \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u043c \u0440\u0443\u043a\u043e\u043f\u043e\u0436\u0430\u0442\u0438\u0435\u043c \u0441 \u0443\u0437\u043b\u043e\u043c), \u0430 \u0441\u043b\u0435\u0434\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: <em>\u00ab\u0410 \u0447\u0442\u043e \u0435\u0449\u0451 \u0432 \u0434\u0432\u0438\u0436\u043a\u0435 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u043c \u0441\u043b\u043e\u0432\u0435?\u00bb<\/em><\/p>\n<p>\u041c\u044b \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0432\u044c\u044e \u0432\u0441\u0435\u0433\u043e \u044f\u0434\u0440\u0430 \u2014 \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0438\u043a\u0441\u043e\u043c \u0442\u0443\u0442 \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u0430\u0435\u0448\u044c\u0441\u044f, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043a\u043e\u0434\u0430. \u041d\u0438\u0436\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 5 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u0433\u0440\u0430\u0431\u043b\u0435\u0439 flat-file CMS \u043d\u0430 PHP, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u0442\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0438 \u0442\u0435\u0445 \u0433\u0440\u0430\u0431\u043b\u0435\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0441\u0430\u043c\u0438, \u043f\u043e\u043a\u0430 \u0432\u043d\u0435\u0434\u0440\u044f\u043b\u0438 \u043f\u0440\u0430\u0432\u043a\u0438.<\/p>\n<hr\/>\n<h4>\u0413\u0440\u0430\u0431\u043b\u0438 \u21161. \u0413\u043e\u043d\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 JSON (\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 flock)<\/h4>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 JSON \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e PHP-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430: \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0444\u0430\u0439\u043b, \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c, \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <code>file_put_contents(..., LOCK_EX)<\/code>.<\/p>\n<pre><code class=\"php\">\/\/ \u0411\u042b\u041b\u041e: \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Race Condition\\(box = json_decode(file_get_contents(\\)MAIL_FILE), true) ?: [];array_unshift(box, new_message);file_put_contents(\\(MAIL_FILE, json_encode(\\)box), LOCK_EX);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p><strong>\u0412 \u0447\u0451\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/strong> \u0444\u043b\u0430\u0433 <code>LOCK_EX<\/code> \u0432 <code>file_put_contents<\/code> \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b <em>\u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0430\u043c\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/em>, \u043d\u043e \u043d\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u0442\u044f\u0442 \u0434\u0432\u0430 P2P-\u043f\u0438\u0441\u044c\u043c\u0430 \u0438\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0436\u043c\u0443\u0442 \u00ab\u043b\u0430\u0439\u043a\u00bb, \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u0441\u0442\u0430\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0430\u0439\u043b\u0430, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e.<\/p>\n<p><strong>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:<\/strong> \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0435\u0434\u0438\u043d\u0443\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443 <code>pig_json_update()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b <em>\u0447\u0442\u0435\u043d\u0438\u0435 \u2192 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u2192 \u0437\u0430\u043f\u0438\u0441\u044c<\/em>:<\/p>\n<pre><code class=\"php\">\/\/ \u0421\u0422\u0410\u041b\u041e: \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0439 read-modify-write \u043f\u043e\u0434 \u0437\u0430\u043c\u043a\u043e\u043c flockfunction pig_json_update(string \\$filepath, callable callback, default = []) {    \\(fp = @fopen(\\)filepath, 'c+');    if (!\\$fp) return false;    \\$result = false;    if (flock(\\$fp, LOCK_EX)) {        \\(content = stream_get_contents(\\)fp);        data = (content !== false &amp;&amp; \\(content !== '') ? json_decode(\\)content, true) : null;        if (!is_array(\\$data)) data = default;        \\$new_data = callback(data);        if (\\$new_data !== null) {            ftruncate(\\$fp, 0);            rewind(\\$fp);            fwrite(\\(fp, json_encode(\\)new_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));            fflush(\\$fp);            result = new_data;        }        flock(\\$fp, LOCK_UN);    }    fclose(\\$fp);    return \\$result;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u043e\u0433\u043d\u0430\u043b\u0438 \u0432\u0441\u0451: \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e P2P-\u043f\u043e\u0447\u0442\u0443, \u043b\u0430\u0439\u043a\u0438, \u0436\u0430\u043b\u043e\u0431\u044b \u0432 \u043c\u0430\u0440\u043a\u0435\u0442\u0435, \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430 \u0442\u0440\u0435\u043a\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043a \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u0438 \u0434\u0430\u0436\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u00ab\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u041b\u0430\u043c\u043f\u043e\u0447\u043a\u0438\u00bb \u0432 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0435.<\/p>\n<hr\/>\n<h4>\u0413\u0440\u0430\u0431\u043b\u0438 \u21162. \u041f\u0430\u0440\u043e\u043b\u0438 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0438 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u044b\u0435 502 \u043d\u0430 \u0448\u0430\u0440\u0435\u0434-\u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435<\/h4>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043b\u043e\u0433\u0438\u043d\u044b \u0438 \u043f\u0430\u0440\u043e\u043b\u0438 \u043b\u0435\u0436\u0430\u043b\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 <code>config.php<\/code> \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u2014 \u043d\u0443\u0436\u043d\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043c\u044b \u043f\u043e\u0439\u043c\u0430\u043b\u0438 <strong>\u0434\u0432\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/strong> \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 (Nginx + PHP-FPM \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u043c \u0442\u0430\u0440\u0438\u0444\u0435):<\/p>\n<ol>\n<li>\n<p><strong>\u0422\u044f\u0436\u0451\u043b\u044b\u0439 <\/strong><code><strong>bcrypt<\/strong><\/code><strong> \u0440\u043e\u043d\u044f\u043b \u0432\u043e\u0440\u043a\u0435\u0440\u044b PHP-FPM \u0432 <\/strong><code><strong>502 Bad Gateway<\/strong><\/code><strong>.<\/strong> \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>password_hash()<\/code> \/ <code>password_verify()<\/code> \u043d\u0430 \u0441\u043b\u0430\u0431\u043e\u043c \u0442\u0430\u0440\u0438\u0444\u0435 PHP-FPM \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u0432 \u043b\u0438\u043c\u0438\u0442 \u043f\u0430\u043c\u044f\u0442\u0438\/CPU \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u043b\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c <\/strong><code><strong>.php<\/strong><\/code><strong>-\u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043b\u0435\u0442\u0443 \u0443\u0431\u0438\u0432\u0430\u043b\u0430 OPcache.<\/strong> \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0430\u0432\u0442\u043e-\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 <code>config.php<\/code>. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 PHP-\u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0430\u043c \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0430, OPcache \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u044d\u0448 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0440\u043e\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u0442\u043e\u0439 \u0436\u0435 502-\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0412\u044b\u043d\u0435\u0441\u043b\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0445\u044d\u0448\u0435\u0439 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e PHP-\u043a\u043e\u0434\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <code>data\/users.json<\/code> (\u043f\u0430\u043f\u043a\u0430 <code>data\/<\/code> \u0437\u0430\u043a\u0440\u044b\u0442\u0430 \u0438\u0437\u0432\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 <code>.htaccess<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0448\u043b\u0438 \u043d\u0430 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043e\u043b\u0451\u043d\u044b\u0439 <code>SHA-256<\/code> (<code>sha256$\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f_\u0441\u043e\u043b\u044c$\u0445\u044d\u0448<\/code>) \u0441\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u0447\u0435\u0440\u0435\u0437 <code>hash_equals()<\/code> \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0430\u0442\u0430\u043a \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (timing attacks) \u2014 0 \u043b\u0438\u0448\u043d\u0435\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 PHP-FPM \u0438 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u043c\u0435\u043d\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0430\u0434\u043c\u0438\u043d\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>\u0413\u0440\u0430\u0431\u043b\u0438 \u21163. \u041e\u0442\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 SSL \u0432 cURL<\/h4>\n<p>\u0414\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 (P2P-\u043f\u043e\u0447\u0442\u0430, \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0434\u0438\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0439, \u043f\u0438\u043d\u0433 \u0441\u0435\u0442\u0438) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f cURL \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u043e\u0439 \u0438\u0437 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432: <code>CURLOPT_SSL_VERIFYPEER =&gt; false<\/code>. \u042d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u043e \u0434\u043e\u0440\u043e\u0433\u0443 \u0434\u043b\u044f MITM-\u0430\u0442\u0430\u043a \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438.<\/p>\n<p><strong>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:<\/strong> \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 (<code>CURLOPT_SSL_VERIFYPEER =&gt; true<\/code>, <code>CURLOPT_SSL_VERIFYHOST =&gt; 2<\/code>), \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0439 \u0444\u043e\u043b\u043b\u0431\u044d\u043a: \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 (<code>CURLE_SSL_CACERT<\/code> \u0438 \u0434\u0440., \u043a\u043e\u0434\u044b <code>35, 51, 60, 77<\/code>), \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u043b\u043e\u043c\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<hr\/>\n<h4>\u0413\u0440\u0430\u0431\u043b\u0438 \u21164. \u0413\u043e\u043b\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0435<\/h4>\n<p>\u0412 \u0434\u0432\u0438\u0436\u043e\u043a \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0441\u0432\u043e\u044f \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0431\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u0432 \u0434\u043d\u0435\u0432\u043d\u043e\u0439 JSON-\u043b\u043e\u0433 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0433\u043e\u0441\u0442\u0435\u0439. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0443\u0442\u0435\u0447\u0451\u0442, \u0443\u0442\u0435\u043a\u0443\u0442 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p><strong>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:<\/strong> \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 CMS \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u043e\u043b\u044c (<code>random_bytes(16)<\/code>) \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0430\u0439\u0442\u0430, \u0430 \u0432 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043b\u043e\u0433 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043b\u0430\u0439\u043a\u043e\u0432 \u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u044b\u0439 \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a:<\/p>\n<pre><code class=\"php\">\\$visitor_hash = substr(hash('sha256', \\(raw_ip . '\\vert{}' .\\)ua . '|' . \\(today . '\\vert{}' .\\)salt), 0, 24);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435 \u0442\u043e\u0447\u043d\u043e, \u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 IP \u0438\u0437 \u043b\u043e\u0433\u0430 \u0443\u0436\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<hr\/>\n<h4>\u0413\u0440\u0430\u0431\u043b\u0438 \u21165. \u0416\u0451\u0441\u0442\u043a\u0438\u0439 \u0431\u0430\u043d \u043f\u043e IP \u043f\u0440\u043e\u0442\u0438\u0432 NAT (\u043e\u0444\u0438\u0441\u043e\u0432 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439)<\/h4>\n<p>\u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043f\u043e-\u0441\u043f\u0430\u0440\u0442\u0430\u043d\u0441\u043a\u0438: 3 \u043e\u0448\u0438\u0431\u043a\u0438 \u2192 \u0431\u0430\u043d IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0430 \u0447\u0430\u0441 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 PHP. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u0438 NAT: \u0435\u0441\u043b\u0438 50 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u0438\u0434\u044f\u0442 \u0437\u0430 \u043e\u0434\u043d\u0438\u043c \u043e\u0444\u0438\u0441\u043d\u044b\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043e\u0434\u0438\u043d \u043a\u0440\u0438\u0432\u043e\u0440\u0443\u043a\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0432\u0445\u043e\u0434 \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c.<\/p>\n<p><strong>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:<\/strong> \u0443\u0431\u0440\u0430\u043b\u0438 \u0436\u0451\u0441\u0442\u043a\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 3-\u0445 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u0432\u0445\u043e\u0434\u0430 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u0430\u043f\u0447\u0430. \u0411\u043e\u0442\u043e\u0432 \u044d\u0442\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442, \u0430 \u0436\u0438\u0432\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438\u0437 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442 <code>4 + 7<\/code> \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0430\u043d\u0435\u043b\u044c.<\/p>\n<hr\/>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>\u0412\u0435\u0441\u044c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0437\u0430\u043d\u044f\u043b \u043e\u0434\u0438\u043d \u043f\u043b\u043e\u0442\u043d\u044b\u0439 \u0432\u0435\u0447\u0435\u0440, \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b 15 \u0444\u0430\u0439\u043b\u043e\u0432 \u044f\u0434\u0440\u0430 \u0438 \u0432\u0435\u0447\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u0432 \u0440\u0435\u043b\u0438\u0437 <code>v2026.2<\/code> \u043d\u0430 GitHub.<\/p>\n<p>\u0415\u0449\u0451 \u0440\u0430\u0437 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441 \u0440\u0430\u0434\u0438\u043e <strong>\u00ab\u041c\u0443\u0445\u043e\u043c\u043e\u0440 \u0421\u041f\u0431\u00bb<\/strong> \u2014 \u043e\u0434\u0438\u043d \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u043f\u043e\u043b\u0435\u0432\u043e\u0439 \u0442\u0435\u0441\u0442 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u0430\u0451\u0442 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u044b, \u0447\u0435\u043c \u0441\u043e\u0442\u043d\u044f \u043b\u0430\u0439\u043a\u043e\u0432. \u0415\u0441\u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u043f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 flat-file \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u2014 \u043c\u0438\u043b\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0438\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1112932\/\">https:\/\/habr.com\/ru\/articles\/1112932\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u0435\u0440\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 \u0434\u0435\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 CMS \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c PHP \u0431\u0435\u0437 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432\u0441\u044f \u00ab\u0431\u0430\u0437\u0430\u00bb \u043b\u0435\u0436\u0438\u0442 \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 JSON-\u0444\u0430\u0439\u043b\u0430\u0445). \u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0441\u0430\u0439\u0442\u0430 \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u00ab\u043f\u043b\u0430\u043d\u0435\u0442\u0430\u00bb \u0432 \u043e\u0431\u0449\u0435\u0439 \u0441\u0435\u0442\u0438, \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u0430\u044f P2P-\u043f\u043e\u0447\u0442\u0430 \u043d\u0430 cURL, \u043e\u0431\u043c\u0435\u043d \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430\u043c\u0438 \u0438 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0434\u0438\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u0432\u0438\u0442\u044c \u044d\u0444\u0438\u0440 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0441\u0435\u0442\u0438.\u042f \u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0441\u044f \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430: \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u043d\u0430\u044f \u0442\u0438\u0448\u0438\u043d\u0430, \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435 \u00ab\u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c WordPress\u00bb. \u041d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0432\u0451\u043b \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u0435\u0432\u043e\u0439 \u0442\u0435\u0441\u0442.\u0412 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043b\u0430\u043d\u0435\u0442 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0441 \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u041c\u0443\u0445\u043e\u043c\u043e\u0440 \u0421\u041f\u0431\u00bb, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0434\u043e\u043c\u0435\u043d\u0443 pigcms.\u0440\u0443. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0435\u0451 \u0432\u043e\u043b\u043d\u0443 \u0432 \u0440\u0430\u0434\u0438\u043e\u043f\u043b\u0435\u0435\u0440\u0435 \u0432\u044b\u043b\u0435\u0442\u0430\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u2014 \u044d\u0444\u0438\u0440\u0430 \u0442\u0430\u043c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e.\u0422\u0430\u043a\u043e\u0439 \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u00ab\u043d\u0430\u043c\u0451\u043a\u00bb \u043e\u0442 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u041f\u0438\u0442\u0435\u0440\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043b\u0443\u0447\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u0442\u0430. \u0421\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043f\u043b\u0430\u043d\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0432\u0435\u0440\u0447\u0438\u0432 (\u0442\u0443 \u043b\u0430\u0437\u0435\u0439\u043a\u0443 \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043a\u0440\u044b\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 DNS \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u043c \u0440\u0443\u043a\u043e\u043f\u043e\u0436\u0430\u0442\u0438\u0435\u043c \u0441 \u0443\u0437\u043b\u043e\u043c), \u0430 \u0441\u043b\u0435\u0434\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u00ab\u0410 \u0447\u0442\u043e \u0435\u0449\u0451 \u0432 \u0434\u0432\u0438\u0436\u043a\u0435 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u043c \u0441\u043b\u043e\u0432\u0435?\u00bb\u041c\u044b \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0432\u044c\u044e \u0432\u0441\u0435\u0433\u043e \u044f\u0434\u0440\u0430 \u2014 \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0438\u043a\u0441\u043e\u043c \u0442\u0443\u0442 \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u0430\u0435\u0448\u044c\u0441\u044f, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043a\u043e\u0434\u0430. \u041d\u0438\u0436\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 5 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u0433\u0440\u0430\u0431\u043b\u0435\u0439 flat-file CMS \u043d\u0430 PHP, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u0442\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0438 \u0442\u0435\u0445 \u0433\u0440\u0430\u0431\u043b\u0435\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0441\u0430\u043c\u0438, \u043f\u043e\u043a\u0430 \u0432\u043d\u0435\u0434\u0440\u044f\u043b\u0438 \u043f\u0440\u0430\u0432\u043a\u0438.\u0413\u0440\u0430\u0431\u043b\u0438 \u21161. \u0413\u043e\u043d\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 JSON (\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 flock)\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 JSON \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e PHP-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430: \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0444\u0430\u0439\u043b, \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c, \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0447\u0435\u0440\u0435\u0437 file_put_contents(&#8230;, LOCK_EX).\/\/ \u0411\u042b\u041b\u041e: \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Race Condition\\(box = json_decode(file_get_contents(\\)MAIL_FILE), true) ?: [];array_unshift(box, new_message);file_put_contents(\\(MAIL_FILE, json_encode(\\)box), LOCK_EX);\u0412 \u0447\u0451\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u0444\u043b\u0430\u0433 LOCK_EX \u0432 file_put_contents \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0430\u043c\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u043d\u043e \u043d\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u0442\u044f\u0442 \u0434\u0432\u0430 P2P-\u043f\u0438\u0441\u044c\u043c\u0430 \u0438\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0436\u043c\u0443\u0442 \u00ab\u043b\u0430\u0439\u043a\u00bb, \u043e\u0431\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u0441\u0442\u0430\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0430\u0439\u043b\u0430, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e.\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438: \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0435\u0434\u0438\u043d\u0443\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443 pig_json_update(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430 \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b \u0447\u0442\u0435\u043d\u0438\u0435 \u2192 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u2192 \u0437\u0430\u043f\u0438\u0441\u044c:\/\/ \u0421\u0422\u0410\u041b\u041e: \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0439 read-modify-write \u043f\u043e\u0434 \u0437\u0430\u043c\u043a\u043e\u043c flockfunction pig_json_update(string \\$filepath, callable callback, default = []) {    \\(fp = @fopen(\\)filepath, &#8216;c+&#8217;);    if (!\\$fp) return false;    \\$result = false;    if (flock(\\$fp, LOCK_EX)) {        \\(content = stream_get_contents(\\)fp);        data = (content !== false &amp;&amp; \\(content !== &#187;) ? json_decode(\\)content, true) : null;        if (!is_array(\\$data)) data = default;        \\$new_data = callback(data);        if (\\$new_data !== null) {            ftruncate(\\$fp, 0);            rewind(\\$fp);            fwrite(\\(fp, json_encode(\\)new_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));            fflush(\\$fp);            result = new_data;        }        flock(\\$fp, LOCK_UN);    }    fclose(\\$fp);    return \\$result;}\u0427\u0435\u0440\u0435\u0437 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u043e\u0433\u043d\u0430\u043b\u0438 \u0432\u0441\u0451: \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e P2P-\u043f\u043e\u0447\u0442\u0443, \u043b\u0430\u0439\u043a\u0438, \u0436\u0430\u043b\u043e\u0431\u044b \u0432 \u043c\u0430\u0440\u043a\u0435\u0442\u0435, \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430 \u0442\u0440\u0435\u043a\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043a \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u0438 \u0434\u0430\u0436\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u00ab\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u041b\u0430\u043c\u043f\u043e\u0447\u043a\u0438\u00bb \u0432 \u043c\u0438\u043d\u0438-\u0438\u0433\u0440\u0435.\u0413\u0440\u0430\u0431\u043b\u0438 \u21162. \u041f\u0430\u0440\u043e\u043b\u0438 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0438 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u044b\u0435 502 \u043d\u0430 \u0448\u0430\u0440\u0435\u0434-\u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043b\u043e\u0433\u0438\u043d\u044b \u0438 \u043f\u0430\u0440\u043e\u043b\u0438 \u043b\u0435\u0436\u0430\u043b\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 config.php \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u2014 \u043d\u0443\u0436\u043d\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c.\u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043c\u044b \u043f\u043e\u0439\u043c\u0430\u043b\u0438 \u0434\u0432\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 (Nginx + PHP-FPM \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u043c \u0442\u0430\u0440\u0438\u0444\u0435):\u0422\u044f\u0436\u0451\u043b\u044b\u0439 bcrypt \u0440\u043e\u043d\u044f\u043b \u0432\u043e\u0440\u043a\u0435\u0440\u044b PHP-FPM \u0432 502 Bad Gateway. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 password_hash() \/ password_verify() \u043d\u0430 \u0441\u043b\u0430\u0431\u043e\u043c \u0442\u0430\u0440\u0438\u0444\u0435 PHP-FPM \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u0432 \u043b\u0438\u043c\u0438\u0442 \u043f\u0430\u043c\u044f\u0442\u0438\/CPU \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u043b\u0441\u044f.\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c .php-\u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043b\u0435\u0442\u0443 \u0443\u0431\u0438\u0432\u0430\u043b\u0430 OPcache. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0430\u0432\u0442\u043e-\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 config.php. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 PHP-\u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0430\u043c \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0430, OPcache \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u044d\u0448 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0440\u043e\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u0442\u043e\u0439 \u0436\u0435 502-\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438:\u0412\u044b\u043d\u0435\u0441\u043b\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0445\u044d\u0448\u0435\u0439 \u0438\u0437 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e PHP-\u043a\u043e\u0434\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b data\/users.json (\u043f\u0430\u043f\u043a\u0430 data\/ \u0437\u0430\u043a\u0440\u044b\u0442\u0430 \u0438\u0437\u0432\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 .htaccess).\u041f\u0435\u0440\u0435\u0448\u043b\u0438 \u043d\u0430 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043e\u043b\u0451\u043d\u044b\u0439 SHA-256 (sha256$\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f_\u0441\u043e\u043b\u044c$\u0445\u044d\u0448) \u0441\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u0447\u0435\u0440\u0435\u0437 hash_equals() \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0430\u0442\u0430\u043a \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (timing attacks) \u2014 0 \u043b\u0438\u0448\u043d\u0435\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 PHP-FPM \u0438 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u043c\u0435\u043d\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0430\u0434\u043c\u0438\u043d\u043a\u0438.\u0413\u0440\u0430\u0431\u043b\u0438 \u21163. \u041e\u0442\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 SSL \u0432 cURL\u0414\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 (P2P-\u043f\u043e\u0447\u0442\u0430, \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0434\u0438\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0439, \u043f\u0438\u043d\u0433 \u0441\u0435\u0442\u0438) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f cURL \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u043e\u0439 \u0438\u0437 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432: CURLOPT_SSL_VERIFYPEER =&gt; false. \u042d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u043e \u0434\u043e\u0440\u043e\u0433\u0443 \u0434\u043b\u044f MITM-\u0430\u0442\u0430\u043a \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438.\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438: \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 (CURLOPT_SSL_VERIFYPEER =&gt; true, CURLOPT_SSL_VERIFYHOST =&gt; 2), \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0439 \u0444\u043e\u043b\u043b\u0431\u044d\u043a: \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 (CURLE_SSL_CACERT \u0438 \u0434\u0440., \u043a\u043e\u0434\u044b 35, 51, 60, 77), \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u043b\u043e\u043c\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441.\u0413\u0440\u0430\u0431\u043b\u0438 \u21164. \u0413\u043e\u043b\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0435\u0412 \u0434\u0432\u0438\u0436\u043e\u043a \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0441\u0432\u043e\u044f \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0431\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u0432 \u0434\u043d\u0435\u0432\u043d\u043e\u0439 JSON-\u043b\u043e\u0433 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0433\u043e\u0441\u0442\u0435\u0439. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0443\u0442\u0435\u0447\u0451\u0442, \u0443\u0442\u0435\u043a\u0443\u0442 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438: \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 CMS \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u043e\u043b\u044c (random_bytes(16)) \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0430\u0439\u0442\u0430, \u0430 \u0432 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043b\u043e\u0433 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043b\u0430\u0439\u043a\u043e\u0432 \u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u044b\u0439 \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a:\\$visitor_hash = substr(hash(&#8216;sha256&#8217;, \\(raw_ip . &#8216;\\vert{}&#8217; .\\)ua . &#8216;|&#8217; . \\(today . &#8216;\\vert{}&#8217; .\\)salt), 0, 24);\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435 \u0442\u043e\u0447\u043d\u043e, \u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 IP \u0438\u0437 \u043b\u043e\u0433\u0430 \u0443\u0436\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.\u0413\u0440\u0430\u0431\u043b\u0438 \u21165. \u0416\u0451\u0441\u0442\u043a\u0438\u0439 \u0431\u0430\u043d \u043f\u043e IP \u043f\u0440\u043e\u0442\u0438\u0432 NAT (\u043e\u0444\u0438\u0441\u043e\u0432 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439)\u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043f\u043e-\u0441\u043f\u0430\u0440\u0442\u0430\u043d\u0441\u043a\u0438: 3 \u043e\u0448\u0438\u0431\u043a\u0438 \u2192 \u0431\u0430\u043d IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0430 \u0447\u0430\u0441 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 PHP. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u0438 NAT: \u0435\u0441\u043b\u0438 50 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u0438\u0434\u044f\u0442 \u0437\u0430 \u043e\u0434\u043d\u0438\u043c \u043e\u0444\u0438\u0441\u043d\u044b\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043e\u0434\u0438\u043d \u043a\u0440\u0438\u0432\u043e\u0440\u0443\u043a\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0432\u0445\u043e\u0434 \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c.\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438: \u0443\u0431\u0440\u0430\u043b\u0438 \u0436\u0451\u0441\u0442\u043a\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 3-\u0445 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u0432\u0445\u043e\u0434\u0430 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u0430\u043f\u0447\u0430. \u0411\u043e\u0442\u043e\u0432 \u044d\u0442\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442, \u0430 \u0436\u0438\u0432\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438\u0437 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442 4 + 7 \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0430\u043d\u0435\u043b\u044c.\u0418\u0442\u043e\u0433\u0412\u0435\u0441\u044c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0437\u0430\u043d\u044f\u043b \u043e\u0434\u0438\u043d \u043f\u043b\u043e\u0442\u043d\u044b\u0439 \u0432\u0435\u0447\u0435\u0440, \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b 15 \u0444\u0430\u0439\u043b\u043e\u0432 \u044f\u0434\u0440\u0430 \u0438 \u0432\u0435\u0447\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u0432 \u0440\u0435\u043b\u0438\u0437 v2026.2 \u043d\u0430 GitHub.\u0415\u0449\u0451 \u0440\u0430\u0437 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441 \u0440\u0430\u0434\u0438\u043e \u00ab\u041c\u0443\u0445\u043e\u043c\u043e\u0440 \u0421\u041f\u0431\u00bb \u2014 \u043e\u0434\u0438\u043d \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u043f\u043e\u043b\u0435\u0432\u043e\u0439 \u0442\u0435\u0441\u0442 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u0430\u0451\u0442 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u044c\u0437\u044b, \u0447\u0435\u043c \u0441\u043e\u0442\u043d\u044f \u043b\u0430\u0439\u043a\u043e\u0432. \u0415\u0441\u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u043f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 flat-file \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u2014 \u043c\u0438\u043b\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0438\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c.\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1112932\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-505003","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/505003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=505003"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/505003\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=505003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=505003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=505003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}