Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8198

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Configuration</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="install.fpm.install.html">Installation</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="install.pecl.html">Installation of PECL extensions</a></div>
 <div class="up"><a href="install.fpm.html">FastCGI Process Manager (FPM)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="install.fpm.configuration" class="sect1">
   <h2 class="title">Configuration</h2>
   <p class="para">
    FPM uses <var class="filename">php.ini</var> syntax for its configuration file - <var class="filename">php-fpm.conf</var>, and pool configuration files.
   </p>
   <div class="sect2"> 
    <h3 class="title">List of global <var class="filename">php-fpm.conf</var> directives</h3>
    <dl>

     <dt id="pid">
      <span class="term">
       <em><code class="parameter">pid</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para"> 
        Path to PID file. Default value: none.
       </p>
      </dd>

     </dt>

     <dt id="error-log">
      <span class="term">
       <em><code class="parameter">error_log</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Path to error log file. Default value:
        <em>#INSTALL_PREFIX#/log/php-fpm.log</em>.
       </p> 
      </dd>

     </dt>

     <dt id="log-level">
      <span class="term">
       <em><code class="parameter">log_level</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Error log level. Possible values: alert, error, warning, notice,
        debug. Default value: notice.
       </p> 
      </dd>

     </dt>

     <dt id="emergency-restart-threshold">
      <span class="term">
       <em><code class="parameter">emergency_restart_threshold</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        If this number of child processes exit with SIGSEGV or SIGBUS within
        the time interval set by <em>emergency_restart_interval</em> 
        then FPM will restart. A value of 0 means &#039;Off&#039;. Default value: 0 (Off).
       </p> 
      </dd>

     </dt>

     <dt id="emergency-restart-interval">
      <span class="term">
       <em><code class="parameter">emergency_restart_interval</code></em>
       <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
      </span>
      <dd>

       <p class="para">
        Interval of time used by emergency_restart_interval to determine when
        a graceful restart will be initiated. This can be useful to work around
        accidental corruptions in an accelerator&#039;s shared memory.
        Available Units: s(econds), m(inutes), h(ours), or d(ays).
        Default Unit: seconds. Default value: 0 (Off).
       </p> 
      </dd>

     </dt>

     <dt id="process-control-timeout">
      <span class="term">
       <em><code class="parameter">process_control_timeout</code></em>
       <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
      </span>
      <dd>

       <p class="para">
        Time limit for child processes to wait for a reaction on signals from
        master. Available units: s(econds), m(inutes), h(ours), or d(ays)
        Default Unit: seconds. Default value: 0.
       </p> 
      </dd>

     </dt>

     <dt id="daemonize">
      <span class="term">
       <em><code class="parameter">daemonize</code></em>
       <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span>
      </span>
      <dd>

       <p class="para">
        Send FPM to background. Set to &#039;no&#039; to keep FPM in foreground for
        debugging. Default value: yes.
       </p> 
      </dd>

     </dt>

    </dl>

   </div>

   <div class="sect2"> 
    <h3 class="title">List of pool directives</h3>
    <p class="para">
     With FPM you can run several pools of processes with different setting.
     These are settings that can be tweaked per pool. 
    </p>
    <dl>

     <dt id="listen">
      <span class="term">
       <em><code class="parameter">listen</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        The address on which to accept FastCGI requests. Valid syntaxes are:
        &#039;ip.add.re.ss:port&#039;, &#039;port&#039;, &#039;/path/to/unix/socket&#039;. This option is
        mandatory for each pool.
       </p> 
      </dd>

     </dt>

     <dt id="listen-backlog">
      <span class="term">
       <em><code class="parameter">listen.backlog</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        Set listen(2) backlog. A value of &#039;-1&#039; means unlimited. Default value:
        -1.
       </p> 
      </dd>

     </dt>

     <dt id="listen-allowed-clients">
      <span class="term">
       <em><code class="parameter">listen.allowed_clients</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        List of ipv4 addresses of FastCGI clients which are allowed to
        connect. Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the
        original PHP FastCGI (5.2.2+). Makes sense only with a tcp listening socket.
        Each address must be separated by a comma. If this value is left blank,
        connections will be accepted from any ip address. Default value: any.
       </p> 
      </dd>

     </dt>

     <dt id="listen-owner">
      <span class="term">
       <em><code class="parameter">listen.owner</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Set permissions for unix socket, if one is used. In Linux, read/write
        permissions must be set in order to allow connections from a web
        server. Many BSD-derived systems allow connections regardless of permissions.
        Default values: user and group are set as the running user, mode is set to 0666.
       </p> 
      </dd>

     </dt>

     <dt id="listen-group">
      <span class="term">
       <em><code class="parameter">listen.group</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        See <em>listen.owner</em>.
       </p> 
      </dd>

     </dt>

     <dt id="listen-mode">
      <span class="term">
       <em><code class="parameter">listen.mode</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        See <em>listen.owner</em>.
       </p> 
      </dd>

     </dt>

     <dt id="user">
      <span class="term">
       <em><code class="parameter">user</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Unix user of FPM processes. This option is mandatory.
       </p> 
      </dd>

     </dt>

     <dt id="group">
      <span class="term">
       <em><code class="parameter">group</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Unix group of FPM processes. If not set, the default user&#039;s group is
        used. 
       </p> 
      </dd>

     </dt>

     <dt id="pm">
      <span class="term">
       <em><code class="parameter">pm</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Choose how the process manager will control the number of child
        processes. Possible values: <em>static</em>, <em>ondemand</em>,
        <em>dynamic</em>. 
        This option is mandatory.
       </p>
       <p class="para">
        <em>static</em> - the number of child processes is fixed (<em>pm.max_children</em>).
       </p>
       <p class="para">
        <em>ondemand</em> - the processes spawn on demand (when requested,
        as opposed to dynamic, where <em>pm.start_servers</em> are started
        when the service is started.
       </p>
       <p class="para">
        <em>dynamic</em> - the number of child processes is set dynamically based on the
        following directives: <em>pm.max_children</em>, <em>pm.start_servers</em>, 
        <em>pm.min_spare_servers</em>, <em>pm.max_spare_servers</em>.
       </p>
      </dd>

     </dt>

     <dt id="pm.max-chidlren">
      <span class="term">
       <em><code class="parameter">pm.max_children</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        The number of child processes to be created when <em>pm</em> is set to
        <em>static</em> and the maximum number of child processes to be created 
        when <em>pm</em> is set to <em>dynamic</em>. This
        option is mandatory.
       </p>
       <p class="para">
        This option sets the limit on the number of simultaneous requests that
        will be served. Equivalent to the ApacheMaxClients directive with
        mpm_prefork and to the <var class="varname"><var class="varname">PHP_FCGI_CHILDREN</var></var> environment variable in the
        original PHP FastCGI.
       </p>
      </dd>

     </dt>

     <dt id="pm.start-servers">
      <span class="term">
       <em><code class="parameter">pm.start_servers</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        The number of child processes created on startup. 
        Used only when <em>pm</em> is set to <em>dynamic</em>.
        Default Value: min_spare_servers + (max_spare_servers -
        min_spare_servers) / 2.
       </p> 
      </dd>

     </dt>

     <dt id="pm.min-spare-servers">
      <span class="term">
       <em><code class="parameter">pm.min_spare_servers</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        The desired minimum number of idle server processes. Used only when
        <em>pm</em> is set to <em>dynamic</em>. Also
        mandatory in this case.
       </p> 
      </dd>

     </dt>

     <dt id="pm.max-spare-servers">
      <span class="term">
       <em><code class="parameter">pm.max_spare_servers</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        The desired maximum number of idle server processes. Used only when
        <em>pm</em> is set to <em>dynamic</em>. Also
        mandatory in this case.
       </p> 
      </dd>

     </dt>

     <dt id="pm.max-requests">
      <span class="term">
       <em><code class="parameter">pm.max_requests</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        The number of requests each child process should execute before
        respawning. This can be useful to work around memory leaks in 3rd party
        libraries. For endless request processing specify &#039;0&#039;. Equivalent to
        <var class="varname"><var class="varname">PHP_FCGI_MAX_REQUESTS</var></var>. Default value: 0.
       </p> 
      </dd>

     </dt>

     <dt id="pm.status-path">
      <span class="term">
       <em><code class="parameter">pm.status_path</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        The URI to view the FPM status page. If this value is not set, no URI
        will be recognized as a status page. Default value: none.
       </p> 
      </dd>

     </dt>

     <dt id="ping.path">
      <span class="term">
       <em><code class="parameter">ping.path</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        The ping URI to call the monitoring page of FPM. If this value is not
        set, no URI will be recognized as a ping page. This could be used to test
        from outside that FPM is alive and responding. Please note that the value must
        start with a leading slash (/).
       </p> 
      </dd>

     </dt>

     <dt id="ping.response">
      <span class="term">
       <em><code class="parameter">ping.response</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        This directive may be used to customize the response to a ping
        request. The response is formatted as text/plain with a 200 response code.
        Default value: pong.
       </p> 
      </dd>

     </dt>

     <dt id="request-terminate-timeout">
      <span class="term">
       <em><code class="parameter">request_terminate_timeout</code></em>
       <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
      </span>
      <dd>

       <p class="para">
        The timeout for serving a single request after which the worker
        process will be killed. This option should be used when the &#039;max_execution_time&#039;
        ini option does not stop script execution for some reason. A value of &#039;0&#039; means
        &#039;Off&#039;. Available units: s(econds)(default), m(inutes), h(ours), or d(ays).
        Default value: 0.
       </p> 
      </dd>

     </dt>

     <dt id="request-slowlog-timeout">
      <span class="term">
       <em><code class="parameter">request_slowlog_timeout</code></em>
       <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
      </span>
      <dd>

       <p class="para">
        The timeout for serving a single request after which a PHP backtrace
        will be dumped to the &#039;slowlog&#039; file. A value of &#039;0&#039; means &#039;Off&#039;.
        Available units: s(econds)(default), m(inutes), h(ours), or d(ays).
        Default value: 0.
       </p> 
      </dd>

     </dt>

     <dt id="slowlog">
      <span class="term">
       <em><code class="parameter">slowlog</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        The log file for slow requests. Default value:
        <em>#INSTALL_PREFIX#/log/php-fpm.log.slow</em>.
       </p> 
      </dd>

     </dt>

     <dt id="rlimit-files">
      <span class="term">
       <em><code class="parameter">rlimit_files</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        Set open file descriptor rlimit. Default value: system defined value.
       </p> 
      </dd>

     </dt>

     <dt id="rlimit-core">
      <span class="term">
       <em><code class="parameter">rlimit_core</code></em>
       <span class="type"><a href="language.types.integer.html" class="type int">int</a></span>
      </span>
      <dd>

       <p class="para">
        Set max core size rlimit. Possible Values: &#039;unlimited&#039; or an integer greater or equal to 0.
        Default value: system defined value.
       </p> 
      </dd>

     </dt>

     <dt id="chroot">
      <span class="term">
       <em><code class="parameter">chroot</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Chroot to this directory at the start. This value must be defined as
        an absolute path. When this value is not set, chroot is not used.
       </p> 
      </dd>

     </dt>

     <dt id="chdir">
      <span class="term">
       <em><code class="parameter">chdir</code></em>
       <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
      </span>
      <dd>

       <p class="para">
        Chdir to this directory at the start. This value must be an absolute
        path. Default value: current directory or / when chroot.
       </p> 
      </dd>

     </dt>

     <dt id="catch-workers-output">
      <span class="term">
       <em><code class="parameter">catch_workers_output</code></em>
       <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span>
      </span>
      <dd>

       <p class="para">
        Redirect worker stdout and stderr into main error log. If not set,
        stdout and stderr will be redirected to /dev/null according to FastCGI specs.
        Default value: no.
       </p> 
      </dd>

     </dt>

    </dl>

    <p class="para">
     It&#039;s possible to pass additional environment variables and update PHP settings of a certain pool.
     To do this, you need to add the following options to the pool configuration file.
     <div class="example" id="example-60">
      <p><strong>Example #1 Passing environment variables and PHP settings to a pool</strong></p>
      <div class="example-contents">
<div class="inicode"><pre class="inicode">env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 32M</pre>
</div>
      </div>

     </div>
     PHP settings passed with <em>php_value</em> or
     <em>php_flag</em> will overwrite their previous value.
     Please note that defining 
     <a href="ini.core.html#ini.disable-functions" class="link">disable_functions</a> or 
     <a href="ini.core.html#ini.disable-classes" class="link">disable_classes</a> will
     not overwrite previously defined <var class="filename">php.ini</var> values, 
     but will append the new value instead.
    </p>
    <p class="para">
     Settings defined with <em>php_admin_value</em> and <em>php_admin_flag</em>
     cannot be overriden with  <span class="function"><a href="function.ini-set.html" class="function">ini_set()</a></span>.
    </p>
    <p class="para">
     As of 5.3.3, PHP settings are also possible to be set in webserver.
     <div class="example" id="example-61">
      <p><strong>Example #2 set PHP settings in nginx.conf</strong></p>
      <div class="example-contents">
       <div class="inicode"><pre class="inicode">set $php_value &quot;pcre.backtrack_limit=424242&quot;;
set $php_value &quot;$php_value \n pcre.recursion_limit=99999&quot;;
fastcgi_param  PHP_VALUE $php_value;

fastcgi_param  PHP_ADMIN_VALUE &quot;open_basedir=/var/www/htdocs&quot;;</pre>
</div>
      </div>

     </div>
     <div class="caution"><strong class="caution">Caution</strong>
      <p class="para">
       Because these settings are passed to php-fpm as fastcgi headers,
       php-fpm should not be bound to a worldwide accessible address.
       Otherwise, anyone could alter the PHP configuration options.
       See also 
       <a href="install.fpm.configuration.html#listen-allowed-clients" class="link">listen.allowed_clients</a>.
      </p>
     </div>
    </p>
   </div>
   
  </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="install.fpm.install.html">Installation</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="install.pecl.html">Installation of PECL extensions</a></div>
 <div class="up"><a href="install.fpm.html">FastCGI Process Manager (FPM)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>