{"id":267679,"date":"2015-11-07T00:21:02","date_gmt":"2015-11-06T21:21:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=267679"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=267679","title":{"rendered":"\u0417\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 php-fpm 5.6, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 systemd, \u0447\u0438\u0442\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f"},"content":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 how-to \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 php-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0433\u043e \u043e\u0442 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0437\u0430\u043f\u0443\u0449\u0435\u043d. \u042f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u044f\u0449\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442 \u0432 \u043c\u0435\u043b\u043e\u0447\u0430\u0445.<\/i><\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f<\/h4>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b, <a href=\"http:\/\/12factor.net\/config\">\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/a>.<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h5>\n<p>  <s>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u00ab\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u00bb.<\/s><br \/>  \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 php-fpm \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (<a href=\"http:\/\/php.net\/manual\/en\/function.getenv.php\">getenv function<\/a>), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a php cli \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h5>\n<p>  <\/p>\n<blockquote><p>\u042d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 .env<\/p><\/blockquote>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u043d\u0430 ZF2. \u0414\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c <a href=\"http:\/\/framework.zend.com\/manual\/current\/en\/tutorials\/config.advanced.html#environment-specific-application-configuration\">\u043a\u043e\u043d\u0444\u0438\u0433-\u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0439<\/a>. \u042d\u0442\u043e \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:  <\/p>\n<ul>\n<li>session.global.php<\/li>\n<li>session.local.php.dist<\/li>\n<li>session.unittest.php.dist<\/li>\n<li>db.global.php<\/li>\n<li>db.local.php.dist<\/li>\n<li>db.unittest.php.dist<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>  \u042d\u0442\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0438 \u0445\u0440\u0430\u043d\u044f\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e php-\u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f, \u0447\u0442\u043e \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 <a href=\"https:\/\/github.com\/vlucas\/phpdotenv\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043c\u0435\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 .env \u0444\u0430\u0439\u043b\u0430 \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0435\u0433\u043e \u0432 $_ENV (\u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e). <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 vlucas\/phpdotenv \u043a ZF2<\/b><\/p>\n<div class=\"spoiler_text\"><code> composer require vlucas\/phpdotenv <\/code><br \/>  \u041e\u0442\u043a\u0440\u044b\u0442\u044c public\/index.php<br \/>  \u041f\u043e\u0441\u043b\u0435 require &#8216;init_autoloader.php&#8217; \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c:  <\/p>\n<pre><code class=\"php\">$dotenv = new Dotenv\\Dotenv(__DIR__ . '\/..\/'); \/\/ $dotenv-&gt;required('SOME_IMPORTANT'); \/\/ \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 $dotenv-&gt;load(); \/\/ \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c overload(), \u0442\u043e\u0433\u0434\u0430 \u0444\u0430\u0439\u043b .env \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u0435\u043d, \u0447\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (\u043a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e (\u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e), \u0434\u043e\u0431\u0430\u0432\u0438\u043b helper-\u0444\u0443\u043d\u043a\u0446\u0438\u044e env() \u0438\u0437 laravel, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 php getenv().<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 env($key, $default = null) \u0432 ZF2<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <b>library\/Common\/Config\/env.php<\/b>, \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:  <\/p>\n<pre><code class=\"php\">if ( ! function_exists('value')) {     \/**      * Return the default value of the given value.      *      * @param  mixed  $value      * @return mixed      *\/     function value($value)     {         return $value instanceof Closure ? $value() : $value;     } } if ( ! function_exists('env')) {     \/**      * Gets the value of an environment variable. Supports boolean, empty and null.      *      * @param  string  $key      * @param  mixed   $default      * @return mixed      *\/     function env($key, $default = null)     {         $value = getenv($key);          if ($value === false) return value($default);          switch (strtolower($value))         {             case 'true':             case '(true)':                 return true;              case 'false':             case '(false)':                 return false;              case 'empty':             case '(empty)':                 return '';              case 'null':             case '(null)':                 return;         }          return $value;     } } <\/code><\/pre>\n<p>  \u0412 <b>composer.json<\/b> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0435\u043a\u0446\u0438\u044e \u00abautoload\u00bb:  <\/p>\n<pre><code>&quot;autoload&quot; : {         ...,         &quot;files&quot;: [&quot;library\/Common\/Config\/env.php&quot;]     }, <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <b>composer dumpautoload<\/b>.  <\/div>\n<\/div>\n<p>  \u042d\u0442\u043e\u0442 \u0448\u0430\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0432\u0441\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u043a\u043e\u043d\u0444\u0438\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 (local.php, unittest.php, *.php.dist). \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f .env.global \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e?<\/b><\/p>\n<div class=\"spoiler_text\"><b>\u041d\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0437\u0430\u043f\u0443\u0449\u0435\u043d.<\/b><br \/>  1. \u0422.\u043a. \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0438 \u043d\u0435\u0442, \u0434\u0430 \u0438 \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 phpdotenv \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 .env \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u0433\u043e\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 $_ENV[$name] = $value.<br \/>  2. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 env(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 php-\u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 getenv(), \u0438 \u0447\u0438\u0442\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.  <\/p>\n<pre><code class=\"php\">\/\/ \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: $config['emails']['from'] = env('APP_EMAIL', 'info@myemail.com'); $config['is_production'] = ( 'production' == env('APP_ENV') ); if (env('ZF_DEBUG_TOOLS', false)) {     $config['modules'][] = 'ZendDeveloperTools'; } <\/code><\/pre>\n<p>  3. \u0424\u0430\u0439\u043b .env <i>\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c<\/i>. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 .env \u0444\u0430\u0439\u043b\u0430 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f exception (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f), \u043d\u0430 production \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c. \u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f exception, \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (touch .env). <br \/>  4. \u0424\u0430\u0439\u043b .env \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 .env \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438.<br \/>  5. \u0424\u0430\u0439\u043b .env <i>\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c<\/i> \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439. \u0415\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 ignore \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439.<br \/>  6. \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0432 index.php \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"php\">$dotenv-&gt;required('APP_ENV'); \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f APP_ENV \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0432 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 .env \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/code><\/pre>\n<p>  7. \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432\u0438\u0434\u0430 .env.* (.env.phpunit, .env.develop). \u042d\u0442\u043e \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0438\u043b\u0438 CI-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d (\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e) \u043f\u0440\u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043f\u0438\u044f\u0445 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0417\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u042d\u0442\u0438 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043b\u043e\u0433\u0438\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.  <\/p>\n<blockquote><p>\u0412\u0430\u0436\u043d\u043e: .env.production \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<br \/>  \u0423\u0434\u043e\u0431\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c .env.default \u2013 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e-\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 template \u0434\u043b\u044f .env).<\/p><\/blockquote>\n<p>  \u2013 <i>\u0422\u0430\u043a \u0447\u0442\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 .env? \u041a\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f?<\/i><\/p>\n<p>  \u0412\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445.<br \/>  \u041d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043b\u043e\u0445\u043e\u0433\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b.  <\/p>\n<pre><code class=\"php\">$config['cvs_separator] = ' | '; \/\/ \u044d\u0442\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u044d\u0442\u043e \u0442\u0440\u043e\u0433\u0430\u0442\u044c. $config['like_panel'] = true; \/\/ \u0430 \u044d\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 env('APP_LIKE_PANEL', false) $config['facebook_app_id'] = 88888888881; \/\/ \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b <\/code><\/pre>\n<p>  \u2013 <i>\u0410 \u043a\u0430\u043a \u0431\u044b\u0442\u044c \u0441 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438?<\/i><\/p>\n<p>  \u0425\u0440\u0430\u043d\u0438\u0442\u0435 production-\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0438\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/docs.ansible.com\/ansible\/playbooks_vault.html\">\u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430<\/a>.  <\/div>\n<\/div>\n<h4>\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043d\u043e&#8230;<\/h4>\n<p>  \u041f\u043e\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u043b\u0430\u0441\u044c \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043c\u0430\u0448\u0438\u043d\u043a\u0430\u0445, \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0438\u0442\u0430\u043b .env \u0444\u0430\u0439\u043b \u0438 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0441\u0440\u0435\u0434\u0443, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0437\u0430\u043f\u0440\u0430\u0432\u0434\u0430\u0448\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, php-fpm \u0438\u0445 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442. \u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0438\u0437 \u0433\u0443\u0433\u043b\u0430 \u0438 StackOverflow \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043a \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432:<\/p>\n<p>  1. \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 nginx \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c fastcgi_param SOMEENV test;<br \/>  2. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 env[SOME_VAR] <a href=\"http:\/\/stackoverflow.com\/a\/30822781\/1929406\">\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0443\u043b\u0430 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 php-fpm<\/a>.<\/p>\n<p>  \u0418 \u043f\u0435\u0440\u0432\u044b\u0439, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0443\u0434\u043e\u0431\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b\u0441\u043b\u0438\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 \u00ab\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0443, \u0430 \u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u00bb, \u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u0442\u0440\u0443\u0434\u043d\u0435\u0435, \u0447\u0435\u043c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c .env \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c. \u041d\u043e \u0432\u0435\u0434\u044c \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440, CI-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u044d\u0442\u043e \u043d\u0435 \u0438\u0437\u044f\u0449\u043d\u043e.<\/p>\n<h5>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h5>\n<p>  \u0421\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0438\u0437 \u0441\u0435\u0442\u0438, \u044f \u043d\u0430\u0449\u0443\u043f\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<br \/>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434 Centos 7, PHP 5.6.14.<\/p>\n<pre><code class=\"bash\">1. \u041e\u0442\u043a\u0440\u044b\u0442\u044c \/etc\/php.ini  - \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c variables_order = &quot;GPCS&quot;  \u043d\u0430  variables_order = &quot;EGPCS&quot; # \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e PHP \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f # http:\/\/php.net\/manual\/ru\/ini.core.php#ini.variables-order  2. \u041e\u0442\u043a\u0440\u044b\u0442\u044c \/etc\/php-fpm.d\/www.conf, \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \/etc\/php-fpm.conf (\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u044d\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433 www-\u043f\u0443\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f php-fpm.  - \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0435\u0441\u0442\u044c): clear_env = no # \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0447\u0438\u0441\u0442\u043a\u0443 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432  3. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \/etc\/environment (\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 A=B)  4. ln -fs \/etc\/environment \/etc\/sysconfig\/php-fpm # \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 php-fpm \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433  5. service php-fpm restart <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u043e\u043c, \u0432 \u0442\u0435\u043e\u0440\u0438\u0438, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0438 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c.<\/p>\n<p>  <b>\u041f\u043b\u044e\u0441\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/b><br \/>   \u2014 \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \/etc\/environment, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c echo $MYSQL_HOST \u0432 shell \u0438\u043b\u0438 getenv(&#8216;MYSQL_HOST&#8217;) \u0432 php.<br \/>   \u2014 \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b \u0432 \/etc\/environment, \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 php-fpm. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u0432\u043d\u0435 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<p>  <b>\u041c\u0438\u043d\u0443\u0441\u044b:<\/b><br \/>   \u2014 \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0443 php-fpm \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f reload \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 nginx, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \/etc\/environment, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c <i>service php-fpm restart<\/i>.<\/p>\n<blockquote><p><b>\u0412\u0430\u0436\u043d\u043e<\/b>: \u0435\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0432 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 (\u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0430, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440), \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u0437-\u0437\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0438\u043c\u0451\u043d \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p><\/blockquote>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438:<br \/>   \u2014 \u041c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u044f \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 SAAS: <a href=\"http:\/\/12factor.net\/config\">\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438<\/a> (\u0430\u043d\u0433\u043b.)<br \/>   \u2014 \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/github.com\/vlucas\/phpdotenv\">\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e .env-\u0444\u0430\u0439\u043b\u043e\u0432<\/a> \u0434\u043b\u044f development environment \u0432 php-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.               <\/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\/270359\/\"> http:\/\/habrahabr.ru\/post\/270359\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 how-to \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 php-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0433\u043e \u043e\u0442 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0437\u0430\u043f\u0443\u0449\u0435\u043d. \u042f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u044f\u0449\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442 \u0432 \u043c\u0435\u043b\u043e\u0447\u0430\u0445.<\/i><\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f<\/h4>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b, <a href=\"http:\/\/12factor.net\/config\">\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/a>.<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h5>\n<p>  <s>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u00ab\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u00bb.<\/s><br \/>  \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 php-fpm \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (<a href=\"http:\/\/php.net\/manual\/en\/function.getenv.php\">getenv function<\/a>), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a php cli \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c.  <\/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-267679","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267679","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=267679"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267679\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}