{"id":265370,"date":"2015-09-10T15:29:02","date_gmt":"2015-09-10T11:29:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265370"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265370","title":{"rendered":"\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 PHP \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 \u043f\u043e\u0434\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cf7\/4af\/71b\/cf74af71b5b74c3ca00c8eaacc5cdb26.jpg\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u0430\u043a\u0438\u0445 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0449\u0430\u0445, \u043a\u0430\u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 (\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435) \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0432 \u044f\u0437\u044b\u043a\u0435 PHP.<br \/>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 PHP \u2014 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0438 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c. \u041d\u043e \u0447\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043b\u0435\u0441, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u043e\u044f\u0442 \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u00ab\u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f\u00bb \u0441 \u043f\u044b\u0445\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0431\u043e\u044f\u0442\u0441\u044f \u0438 \u043d\u0435 \u0445\u043e\u0442\u044f\u0442. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u0430\u044e\u0442.<br \/>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c\u2026<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0437\u0430\u0434 \u043f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0441\u0442\u043e\u044f\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 20 \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043f\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0443 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u043e\u0432\u0430\u0440\u0430.<br \/>  \u0412\u0441\u0451 \u044d\u0442\u043e \u0432\u0438\u0441\u0435\u043b\u043e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438 \u0442\u043f. \u041d\u043e \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0435\u0434\u0438\u043d\u044b\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u043c. \u0418 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e. \u041e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0430\u0441\u0430\u043b\u043e, \u043d\u043e \u0432 \u043e\u0447\u0435\u043d\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445, \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439.<\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u044b\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442: \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0442\u043e\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043f\u0440\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u043e\u0441\u044c. \u041e\u0442\u0432\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u044b\u043f\u043b\u0451\u0432\u044b\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442, \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0437\u0430\u0448\u043b\u0438 \u0432 \u0442\u0443\u043f\u0438\u043a, \u0438 \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0441\u0430\u043c\u0438 \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041d\u043e \u0441 PHP \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<p>  \u0411\u044b\u043b\u0438 \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:  <\/p>\n<ul>\n<li><a href=\"http:\/\/php.net\/manual\/ru\/class.thread.php\">PHP: Thread<\/a><\/li>\n<li><a href=\"http:\/\/php.net\/manual\/ru\/function.pcntl-fork.php\">pcntl_fork()<\/a><\/li>\n<li>\u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/li>\n<\/ul>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0438 \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0438. \u0411\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  \u041d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u043e. \u0418 \u0435\u0449\u0451 \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e \u043d\u0435\u043a\u043e\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u0438\u0438 \u201c\u043f\u043e\u0434\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432\u201d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0430\u043d\u0430\u043b\u043e\u0433 <i>exec()<\/i> \u0444\u0443\u043d\u043a\u0446\u0438\u0438).<\/p>\n<p>  \u0421 \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u0440\u043e\u0448\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0434\u0430\u0432\u043d\u043e \u0443\u0448\u0435\u043b. \u041d\u043e \u0432\u043e\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0435\u0439 entity \u0438 \u0447\u0430\u0441\u0442\u044c \u0435\u0451 \u0442\u044f\u0436\u0435\u043b\u044b\u0445 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 2 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0449\u0438\u0445 \u044d\u0442\u043e \u0432 \u0411\u0414. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 2800. \u041c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e <\/p>\n<pre><code class=\"bash\">PHP Fatal error:  Allowed memory size of &lt;over9000&gt; bytes exhausted. <\/code><\/pre>\n<p>  \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0438\u0437 50 entities \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f, \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, 190\u043c\u0431 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u043d\u043e\u0432\u044b\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u043c \u043a\u043e\u043b-\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u043e\u0441\u043b\u043e. \u041f\u0440\u0438 \u043f\u043e\u043b\u043d\u043e\u043c \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043a\u0438, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u043b\u044e\u0441 Segmentation Fault.<\/p>\n<p>  \u0422.\u0435. \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u201c\u0447\u0443\u0442\u043e\u0447\u043a\u0443\u201d \u043f\u043e\u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0421\u043f\u0435\u0440\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0432 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u043e\u0433\u0438 \u0440\u0430\u0441\u0442\u0443\u0442 \u0438\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u043c\u0444\u043e\u0432\u043e\u0433\u043e ServiceContainer \u0438 EventDispatcher. \u0422\u0430\u043c \u0432 event \u043f\u043e\u0434\u043f\u0438\u0445\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0438 \u043f\u043e\u0442\u043e\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e. \u041e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u0431\u044b\u043b\u043e, \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043b\u0435\u043d\u044c, \u0438 \u043c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u0437\u044f\u0449\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412 \u043d\u0430\u0431\u043e\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 Symfony2 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u0430\u043a <a href=\"http:\/\/symfony.com\/doc\/current\/components\/process.html\">Symfony Process Component<\/a>.<br \/>  \u042d\u0442\u0430 \u0432\u0443\u043d\u0434\u0435\u0440\u0432\u0430\u0444\u043b\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u0445\u043e\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 CLI-\u0440\u0435\u0436\u0438\u043c\u0435 (\u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443).<\/p>\n<p>  \u0421\u043f\u0435\u0440\u0432\u0430 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u201c\u043e\u0442\u043f\u043e\u0447\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u201d \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RAM. \u041d\u043e \u043f\u043e\u0442\u043e\u043c \u0432 \u0434\u043e\u043a\u0430\u0445 \u0432\u044b\u0447\u0438\u0442\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<p>  \u0411\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u0434\u0435\u043b\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0447\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e(\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 Example-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043d\u0430 GitHub. \u041b\u043e\u0433\u0438\u043a\u0430 \u0441\u0430\u043c\u0438\u0445 \u043f\u043e\u0434\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u0443\u0442\u044f\u0436\u0435\u043b\u0435\u043d\u043d\u0430\u044f):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MainCommand<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  namespace Example\\Command;  use Symfony\\Component\\Console\\Command\\Command; use Symfony\\Component\\Console\\Input\\InputInterface; use Symfony\\Component\\Console\\Output\\OutputInterface; use Symfony\\Component\\Process\\Process;  class MainCommand extends Command {    protected function configure()    {        $this-&gt;setName('example:main')            -&gt;setDescription('Run example command with optional number of CPUs')            -&gt;addArgument('CPUs', null, 'number of working CPUs', 2);    }     protected function execute(InputInterface $input, OutputInterface $output)    {        $channels    = [];        $maxChannels = $input-&gt;getArgument('CPUs');         $exampleArray = $this-&gt;getExampleArray();        $output-&gt;writeln('&lt;fg=green&gt;Start example process&lt;\/&gt;');        while (count($exampleArray) &gt; 0 || count($channels) &gt; 0) {            foreach ($channels as $key =&gt; $channel) {                if ($channel instanceof Process && $channel-&gt;isTerminated()) {                    unset($channels[$key]);                }            }            if (count($channels) &gt;= $maxChannels) {                continue;            }             if (!$item = array_pop($exampleArray)) {                continue;            }            $process = new Process(sprintf('php index.php example:sub-process %s', $item), __DIR__ . '\/..\/..\/..\/');            $process-&gt;start();            if (!$process-&gt;isStarted()) {                throw new \\Exception($process-&gt;getErrorOutput());            }            $channels[] = $process;        }        $output-&gt;writeln('&lt;bg=green;fg=black&gt;Done.&lt;\/&gt;');    }     \/**     * @return array     *\/    private function getExampleArray()    {        $array = [];        for ($i = 0; $i &lt; 30; $i++) {            $name = 'No' . $i;            $x1   = rand(1, 10);            $y1   = rand(1, 10);            $x2   = rand(1, 10);            $y2   = rand(1, 10);             $array[] = $name . '.' . $x1 . '.' . $y1 . '.' . $x2 . '.' . $y2;        }         return $array;    } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">SubProcessCommand<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  namespace Example\\Command;  use Symfony\\Component\\Console\\Command\\Command; use Symfony\\Component\\Console\\Input\\InputInterface; use Symfony\\Component\\Console\\Output\\OutputInterface;  class SubProcessCommand extends Command {    protected function configure()    {        $this-&gt;setName('example:sub-process')            -&gt;setDescription('Run example sub-process command')            -&gt;addArgument('item');    }     protected function execute(InputInterface $input, OutputInterface $output)    {        $items = explode('.', $input-&gt;getArgument('item'));        $pointName = $items[0];        $x1        = $items[1];        $y1        = $items[2];        $x2        = $items[3];        $y2        = $items[4];         \/\/ Used for mocking heavy execution.        $sum = 0;        for ($i = 1; $i &lt;= 30000000; $i++){            $sum += $i;        }         $distance = bcsqrt(pow(($x2 - $x1),2) + pow(($y2 - $y1),2));        $data = sprintf('Point %s: %s', $pointName, (string)$distance);         file_put_contents(__DIR__.'\/..\/..\/..\/output\/Point'.$pointName , print_r($data, 1), FILE_APPEND);    } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">index.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php require __DIR__ . '\/vendor\/autoload.php';  use Symfony\\Component\\Console\\Application;  $application = new Application(); $application-&gt;add(new \\Example\\Command\\MainCommand()); $application-&gt;add(new \\Example\\Command\\SubProcessCommand()); $application-&gt;run(); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6b3\/4f0\/41e\/6b34f041e21f4cbb982a65db5e2cedb0.png\"\/><\/p>\n<p>  \u0421\u043a\u0430\u0436\u0443 \u043e\u0442\u043a\u0440\u043e\u0432\u0435\u043d\u043d\u043e, \u044f \u0431\u044b\u043b \u043e\u0447\u0435\u043d\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0451\u043d \u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<br \/>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u043e\u043c\u043e\u0449\u044c. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0442\u0443\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0433\u0434\u0435 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435.<\/p>\n<p>  <a href=\"https:\/\/github.com\/iCubeDm\/php-subprocess-example\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0437\u044b\u0432\u0430\u043c \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c.               <\/p>\n<div class=\"clear\"><\/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=\"http:\/\/habrahabr.ru\/post\/266615\/\"> http:\/\/habrahabr.ru\/post\/266615\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cf7\/4af\/71b\/cf74af71b5b74c3ca00c8eaacc5cdb26.jpg\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u0430\u043a\u0438\u0445 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0449\u0430\u0445, \u043a\u0430\u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 (\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435) \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0432 \u044f\u0437\u044b\u043a\u0435 PHP.<br \/>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 PHP \u2014 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0438 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c. \u041d\u043e \u0447\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043b\u0435\u0441, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u043e\u044f\u0442 \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u00ab\u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f\u00bb \u0441 \u043f\u044b\u0445\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0431\u043e\u044f\u0442\u0441\u044f \u0438 \u043d\u0435 \u0445\u043e\u0442\u044f\u0442. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u0430\u044e\u0442.<br \/>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c\u2026  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-265370","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265370","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=265370"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265370\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}