<!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>Return info about system resource limits</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.posix-getpwuid.html">posix_getpwuid</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.posix-getsid.html">posix_getsid</a></div> <div class="up"><a href="ref.posix.html">POSIX Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.posix-getrlimit" class="refentry"> <div class="refnamediv"> <h1 class="refname">posix_getrlimit</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">posix_getrlimit</span> — <span class="dc-title">Return info about system resource limits</span></p> </div> <div class="refsect1 description" id="refsect1-function.posix-getrlimit-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>posix_getrlimit</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>posix_getrlimit()</strong></span> returns an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of information about the current resource's soft and hard limits. </p> <p class="para"> Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit. An unprivileged process may only set its soft limit to a value from 0 to the hard limit, and irreversibly lower its hard limit. </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.posix-getrlimit-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an associative <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of elements for each limit that is defined. Each limit has a soft and a hard limit. <table class="doctable table"> <caption><strong>List of possible limits returned</strong></caption> <thead> <tr> <th>Limit name</th> <th>Limit description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>core</td> <td> The maximum size of the core file. When 0, not core files are created. When core files are larger than this size, they will be truncated at this size. </td> </tr> <tr> <td>totalmem</td> <td> The maximum size of the memory of the process, in bytes. </td> </tr> <tr> <td>virtualmem</td> <td> The maximum size of the virtual memory for the process, in bytes. </td> </tr> <tr> <td>data</td> <td> The maximum size of the data segment for the process, in bytes. </td> </tr> <tr> <td>stack</td> <td> The maximum size of the process stack, in bytes. </td> </tr> <tr> <td>rss</td> <td> The maximum number of virtual pages resident in RAM </td> </tr> <tr> <td>maxproc</td> <td> The maximum number of processes that can be created for the real user ID of the calling process. </td> </tr> <tr> <td>memlock</td> <td> The maximum number of bytes of memory that may be locked into RAM. </td> </tr> <tr> <td>cpu</td> <td> The amount of time the process is allowed to use the CPU. </td> </tr> <tr> <td>filesize</td> <td> The maximum size of the data segment for the process, in bytes. </td> </tr> <tr> <td>openfiles</td> <td> One more than the maximum number of open file descriptors. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.posix-getrlimit-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3664"> <p><strong>Example #1 Example use of <span class="function"><strong>posix_getrlimit()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$limits </span><span style="color: #007700">= </span><span style="color: #0000BB">posix_getrlimit</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$limits</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Array ( [soft core] => 0 [hard core] => unlimited [soft data] => unlimited [hard data] => unlimited [soft stack] => 8388608 [hard stack] => unlimited [soft totalmem] => unlimited [hard totalmem] => unlimited [soft rss] => unlimited [hard rss] => unlimited [soft maxproc] => unlimited [hard maxproc] => unlimited [soft memlock] => unlimited [hard memlock] => unlimited [soft cpu] => unlimited [hard cpu] => unlimited [soft filesize] => unlimited [hard filesize] => unlimited [soft openfiles] => 1024 [hard openfiles] => 1024 ) </pre></div> </div> </div> </p> </div> <div class="refsect1 notes" id="refsect1-function.posix-getrlimit-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> This is a not POSIX function, but is common on BSD and System V systems. If the system does not support this function, then it will not be included at compile time. This may be checked with <span class="function"><a href="function.function-exists.html" class="function">function_exists()</a></span>. </p> </p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-function.posix-getrlimit-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member">man page GETRLIMIT(2)</li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.posix-getpwuid.html">posix_getpwuid</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.posix-getsid.html">posix_getsid</a></div> <div class="up"><a href="ref.posix.html">POSIX Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>