mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@77226 c90b9560-bf6c-de11-be94-00142212c4b1
1989 lines
58 KiB
XML
1989 lines
58 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.99 $ -->
|
|
<reference id="ref.info">
|
|
<title>PHP Options&Information</title>
|
|
<titleabbrev>PHP Options/Info</titleabbrev>
|
|
|
|
<refentry id="function.assert">
|
|
<refnamediv>
|
|
<refname>assert</refname>
|
|
<refpurpose>Checks if assertion is &false;</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>assert</methodname>
|
|
<methodparam><type>string|bool</type><parameter>assertion</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>assert</function> will check the given
|
|
<parameter>assertion</parameter> and take appropriate action if
|
|
its result is &false;.
|
|
</para>
|
|
<para>
|
|
If the <parameter>assertion</parameter> is given as a string it
|
|
will be evaluated as PHP code by <function>assert</function>.
|
|
The advantages of a string <parameter>assertion</parameter> are
|
|
less overhead when assertion checking is off and messages
|
|
containing the <parameter>assertion</parameter> expression when
|
|
an assertion fails.
|
|
</para>
|
|
<para>
|
|
Assertions should be used as a debugging feature only. You may
|
|
use them for sanity-checks that test for conditions that should
|
|
always be &true; and that indicate some programming errors if not
|
|
or to check for the presence of certain features like extension
|
|
functions or certain system limits and features.
|
|
</para>
|
|
<para>
|
|
Assertions should not be used for normal runtime operations like
|
|
input parameter checks. As a rule of thumb your code should
|
|
always be able to work correctly if assertion checking is not
|
|
activated.
|
|
</para>
|
|
<para>
|
|
The behavior of <function>assert</function> may be configured by
|
|
<function>assert_options</function> or by .ini-settings described
|
|
in that functions manual page.
|
|
</para>
|
|
<para>
|
|
The <function>assert_options</function> function and/or
|
|
ASSERT_CALLBACK configuration directive allow a callback function
|
|
to be set to handle failed assertions.
|
|
</para>
|
|
<para>
|
|
<function>assert</function> callbacks are particularly useful for
|
|
building automated test suites because they allow you to easily
|
|
capture the code passed to the assertion, along with information
|
|
on where the assertion was made. While this information can be
|
|
captured via other methods, using assertions makes it much faster
|
|
and easier!
|
|
</para>
|
|
<para>
|
|
The callback function should accept three arguments. The first
|
|
argument will contain the file the assertion failed in. The
|
|
second argument will contain the line the assertion failed on and
|
|
the third argument will contain the expression that failed (if
|
|
any - literal values such as 1 or "two" will not be passed via
|
|
this argument)
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Handle a failed assertion with a custom handler</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Active assert and make it quiet
|
|
assert_options (ASSERT_ACTIVE, 1);
|
|
assert_options (ASSERT_WARNING, 0);
|
|
assert_options (ASSERT_QUIET_EVAL, 1);
|
|
|
|
// Create a handler function
|
|
function my_assert_handler ($file, $line, $code) {
|
|
echo "<hr>Assertion Failed:
|
|
File '$file'<br>
|
|
Line '$line'<br>
|
|
Code '$code'<br><hr>";
|
|
}
|
|
|
|
// Set up the callback
|
|
assert_options (ASSERT_CALLBACK, 'my_assert_handler');
|
|
|
|
// Make an assertion that should fail
|
|
assert ('mysql_query ("")');
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.assert-options">
|
|
<refnamediv>
|
|
<refname>assert_options</refname>
|
|
<refpurpose>Set/get the various assert flags</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>assert_options</methodname>
|
|
<methodparam><type>int</type><parameter>what</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>value</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Using <function>assert_options</function> you may set the various
|
|
<function>assert</function> control options or just query their
|
|
current settings.
|
|
</para>
|
|
<table>
|
|
<title>Assert Options</title>
|
|
<tgroup cols="4">
|
|
<thead>
|
|
<row>
|
|
<entry>option</entry>
|
|
<entry>ini-parameter</entry>
|
|
<entry>default</entry>
|
|
<entry>description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>ASSERT_ACTIVE</entry>
|
|
<entry>assert.active</entry>
|
|
<entry>1</entry>
|
|
<entry>enable <function>assert</function> evaluation</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ASSERT_WARNING</entry>
|
|
<entry>assert.warning</entry>
|
|
<entry>1</entry>
|
|
<entry>issue a PHP warning for each failed assertion</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ASSERT_BAIL</entry>
|
|
<entry>assert.bail</entry>
|
|
<entry>0</entry>
|
|
<entry>terminate execution on failed assertions</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ASSERT_QUIET_EVAL</entry>
|
|
<entry>assert.quiet_eval</entry>
|
|
<entry>0</entry>
|
|
<entry>
|
|
disable error_reporting during assertion expression
|
|
evaluation
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ASSERT_CALLBACK</entry>
|
|
<entry>assert_callback</entry>
|
|
<entry>(&null;)</entry>
|
|
<entry>user function to call on failed assertions</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
<para>
|
|
<function>assert_options</function> will return the original
|
|
setting of any option or &false; on errors.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.extension-loaded">
|
|
<refnamediv>
|
|
<refname>extension_loaded</refname>
|
|
<refpurpose>Find out whether an extension is loaded</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>extension_loaded</methodname>
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns &true; if the extension identified by
|
|
<parameter>name</parameter> is loaded. You can see the names of
|
|
various extensions by using <function>phpinfo</function>.
|
|
</simpara>
|
|
<para>
|
|
See also <function>phpinfo</function>.
|
|
<note>
|
|
<para>
|
|
This function was added in 3.0.10.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.dl">
|
|
<refnamediv>
|
|
<refname>dl</refname>
|
|
<refpurpose>Loads a PHP extension at runtime</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>dl</methodname>
|
|
<methodparam><type>string</type><parameter>library</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Loads the PHP extension defined in
|
|
<parameter>library</parameter>. See also the <link
|
|
linkend="ini.sect.extension">Extension Loading Directives</link>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getenv">
|
|
<refnamediv>
|
|
<refname>getenv</refname>
|
|
<refpurpose>Gets the value of an environment variable</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>getenv</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the value of the environment variable
|
|
<parameter>varname</parameter>, or &false; on an error.
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
$ip = getenv ("REMOTE_ADDR"); // get the ip number of the user
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
You can see a list of all the environmental variables by using
|
|
<function>phpinfo</function>. You can find out what many of them
|
|
mean by taking a look at the <ulink url="&url.cgispecs;">CGI
|
|
specification</ulink>, specifically the <ulink
|
|
url="&url.cgispec;">page on environmental variables</ulink>.
|
|
<note>
|
|
<para>
|
|
This function does not work in ISAPI mode.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
See also <function>putenv</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-cfg-var">
|
|
<refnamediv>
|
|
<refname>get_cfg_var</refname>
|
|
<refpurpose>
|
|
Gets the value of a PHP configuration option
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>get_cfg_var</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the current value of the PHP configuration variable
|
|
specified by <parameter>varname</parameter>, or &false; if an
|
|
error occurs.
|
|
</simpara>
|
|
<simpara>
|
|
It will not return configuration information set when the PHP was
|
|
compiled, or read from an Apache configuration file (using the
|
|
php3_configuration_option directives).
|
|
</simpara>
|
|
<simpara>
|
|
To check whether the system is using a <link
|
|
linkend="configuration.file">configuration file</link>, try
|
|
retrieving the value of the cfg_file_path configuration
|
|
setting. If this is available, a configuration file is being
|
|
used.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>ini_get</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-current-user">
|
|
<refnamediv>
|
|
<refname>get_current_user</refname>
|
|
<refpurpose>
|
|
Gets the name of the owner of the current PHP script
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>get_current_user</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the name of the owner of the current PHP script.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>getmyuid</function>,
|
|
<function>getmygid</function>, <function>getmypid</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-defined-constants">
|
|
<refnamediv>
|
|
<refname>get_defined_constants</refname>
|
|
<refpurpose>
|
|
Returns an associative array with the names of all the constants
|
|
and their values
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_defined_constants</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function returns the names and values of all the constants
|
|
currently defined. This includes those created by extensions as
|
|
well as those created with the <function>define</function>
|
|
function.
|
|
</para>
|
|
<para>
|
|
For example the line below
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
print_r (get_defined_constants());
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
will print a list like:
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[E_ERROR] => 1
|
|
[E_WARNING] => 2
|
|
[E_PARSE] => 4
|
|
[E_NOTICE] => 8
|
|
[E_CORE_ERROR] => 16
|
|
[E_CORE_WARNING] => 32
|
|
[E_COMPILE_ERROR] => 64
|
|
[E_COMPILE_WARNING] => 128
|
|
[E_USER_ERROR] => 256
|
|
[E_USER_WARNING] => 512
|
|
[E_USER_NOTICE] => 1024
|
|
[E_ALL] => 2047
|
|
[TRUE] => 1
|
|
)
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
See also <function>get_loaded_extensions</function>,
|
|
<function>get_defined_functions</function> and
|
|
<function>get_defined_vars</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-extension-funcs">
|
|
<refnamediv>
|
|
<refname>get_extension_funcs</refname>
|
|
<refpurpose>
|
|
Returns an array with the names of the functions of a module
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_extension_funcs</methodname>
|
|
<methodparam><type>string</type><parameter>module_name</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function returns the names of all the functions defined in
|
|
the module indicated by <parameter>module_name</parameter>.
|
|
</para>
|
|
<para>
|
|
For example the lines below
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
print_r (get_extension_funcs ("xml"));
|
|
print_r (get_extension_funcs ("gd"));
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
will print a list of the functions in the modules
|
|
<varname>xml</varname> and <varname>gd</varname> respectively.
|
|
</para>
|
|
<para>
|
|
See also: <function>get_loaded_extensions</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmygid">
|
|
<refnamediv>
|
|
<refname>getmygid</refname>
|
|
<refpurpose>Get PHP script owner's GID</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getmygid</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the group ID of the current script, or &false; on error.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>getmyuid</function>,
|
|
<function>getmypid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-included-files">
|
|
<refnamediv>
|
|
<refname>get_included_files</refname>
|
|
<refpurpose>
|
|
Returns an array with the names of included or required files
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_included_files</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns an array of the names of all files that have been
|
|
included using <function>include</function>,
|
|
<function>include_once</function>, <function>require</function>
|
|
or <function>require_once</function>.
|
|
</para>
|
|
<para>
|
|
Files that are included or required multiple times only show up
|
|
once in the returned array.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Files included using the <literal>auto_prepend_file</literal>
|
|
configuration directive are not included in the returned array.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>get_included_files</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
include("test1.php");
|
|
include_once("test2.php");
|
|
require("test3.php");
|
|
require_once("test4.php");
|
|
|
|
$included_files = get_included_files();
|
|
|
|
foreach($included_files as $filename) {
|
|
echo "$filename\n";
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
will generate the following output:
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
test1.php
|
|
test2.php
|
|
test3.php
|
|
test4.php
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
In PHP 4.0.1pl2 and previous versions
|
|
<function>get_included_files</function> assumed that the
|
|
required files ended in the extension <literal>.php</literal>;
|
|
other extensions would not be returned. The array returned by
|
|
<function>get_included_files</function> was an associative array
|
|
and only listed files included by <function>include</function>
|
|
and <function>include_once</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also: <function>include</function>,
|
|
<function>include_once</function>, <function>require</function>,
|
|
<function>require_once</function>, and
|
|
<function>get_required_files</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-loaded-extensions">
|
|
<refnamediv>
|
|
<refname>get_loaded_extensions</refname>
|
|
<refpurpose>
|
|
Returns an array with the names of all modules compiled and
|
|
loaded
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_loaded_extensions</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function returns the names of all the modules compiled and
|
|
loaded in the PHP interpreter.
|
|
</para>
|
|
<para>
|
|
For example the line below
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
print_r (get_loaded_extensions());
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
will print a list like:
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => xml
|
|
[1] => wddx
|
|
[2] => standard
|
|
[3] => session
|
|
[4] => posix
|
|
[5] => pgsql
|
|
[6] => pcre
|
|
[7] => gd
|
|
[8] => ftp
|
|
[9] => db
|
|
[10] => Calendar
|
|
[11] => bcmath
|
|
)
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
See also: <function>get_extension_funcs</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-magic-quotes-gpc">
|
|
<refnamediv>
|
|
<refname>get_magic_quotes_gpc</refname>
|
|
<refpurpose>
|
|
Gets the current active configuration setting of magic quotes gpc
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>long</type><methodname>get_magic_quotes_gpc</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the current active configuration setting of <link
|
|
linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> (0 for
|
|
off, 1 for on).
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>get_magic_quotes_runtime</function> and
|
|
<function>set_magic_quotes_runtime</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-magic-quotes-runtime">
|
|
<refnamediv>
|
|
<refname>get_magic_quotes_runtime</refname>
|
|
<refpurpose>
|
|
Gets the current active configuration setting of
|
|
magic_quotes_runtime
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>long</type><methodname>get_magic_quotes_runtime</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the current active configuration setting of <link
|
|
linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>
|
|
(0 for off, 1 for on).
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>get_magic_quotes_gpc</function> and
|
|
<function>set_magic_quotes_runtime</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getlastmod">
|
|
<refnamediv>
|
|
<refname>getlastmod</refname>
|
|
<refpurpose>Gets time of last page modification</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getlastmod</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the time of the last modification of the current
|
|
page. The value returned is a Unix timestamp, suitable for
|
|
feeding to <function>date</function>. Returns &false; on error.
|
|
<example>
|
|
<title>getlastmod() example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
// outputs e.g. 'Last modified: March 04 1998 20:43:59.'
|
|
echo "Last modified: " . date ("F d Y H:i:s.", getlastmod());
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>date</function>,
|
|
<function>getmyuid</function>, <function>getmygid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getmypid</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmyinode">
|
|
<refnamediv>
|
|
<refname>getmyinode</refname>
|
|
<refpurpose>Gets the inode of the current script</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getmyinode</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the current script's inode, or &false; on error.
|
|
</para>
|
|
<para>
|
|
See also <function>getmygid</function>,
|
|
<function>getmyuid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmypid</function>, and
|
|
<function>getlastmod</function>.
|
|
</para>
|
|
¬e.no-windows;
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmypid">
|
|
<refnamediv>
|
|
<refname>getmypid</refname>
|
|
<refpurpose>Gets PHP's process ID</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getmypid</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the current PHP process ID, or &false; on error.
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
Process IDs are not unique, thus they are a weak entropy
|
|
source. We recommend against relying on pids in
|
|
security-dependent contexts.
|
|
</para>
|
|
</warning>
|
|
<para>
|
|
See also <function>getmygid</function>,
|
|
<function>getmyuid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmyuid">
|
|
<refnamediv>
|
|
<refname>getmyuid</refname>
|
|
<refpurpose>Gets PHP script owner's UID</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getmyuid</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Returns the user ID of the current script, or &false; on error.
|
|
</simpara>
|
|
<simpara>
|
|
See also <function>getmygid</function>,
|
|
<function>getmypid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-required-files">
|
|
<refnamediv>
|
|
<refname>get_required_files</refname>
|
|
<refpurpose>
|
|
Returns an array with the names of included or required files
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_required_files</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
As of PHP 4.0.4, this function is an alias for
|
|
<function>get_included_files</function>
|
|
</para>
|
|
<para>
|
|
In PHP 4.0.1pl2 and previous versions
|
|
<function>get_required_files</function> assumed that the required
|
|
files ended in the extension <literal>.php</literal>, other
|
|
extensions would not be returned. The array returned by
|
|
<function>get_required_files</function> was an associative array
|
|
and only listed files included by <function>require</function>
|
|
and <function>require_once</function>.
|
|
</para>
|
|
<para>
|
|
See also: <function>require</function>,
|
|
<function>require_once</function>, <function>include</function>,
|
|
<function>include_once</function>, and
|
|
<function>get_included_files</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getrusage">
|
|
<refnamediv>
|
|
<refname>getrusage</refname>
|
|
<refpurpose>Gets the current resource usages</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>getrusage</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>who</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This is an interface to getrusage(2). It returns an associative
|
|
array containing the data returned from the system call. If who
|
|
is 1, getrusage will be called with RUSAGE_CHILDREN.
|
|
</para>
|
|
<para>
|
|
All entries are accessible by using their documented field names.
|
|
<example>
|
|
<title>Getrusage Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$dat = getrusage();
|
|
echo $dat["ru_nswap"]; # number of swaps
|
|
echo $dat["ru_majflt"]; # number of page faults
|
|
echo $dat["ru_utime.tv_sec"]; # user time used (seconds)
|
|
echo $dat["ru_utime.tv_usec"]; # user time used (microseconds)
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
See your system's man page on getrusage(2) for more details.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ini-alter">
|
|
<refnamediv>
|
|
<refname>ini_alter</refname>
|
|
<refpurpose>
|
|
Changes the value of a configuration option
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>ini_alter</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>newvalue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Changes the value of a configuration option, returns &false; on
|
|
failure, and the previous value of the configuration option on
|
|
success.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This is an alias of <function>ini_set</function>
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also <function>ini_get</function>,
|
|
<function>ini_get_all</function>,
|
|
<function>ini_restore</function>, and
|
|
<function>ini_set</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ini-get">
|
|
<refnamediv>
|
|
<refname>ini_get</refname>
|
|
<refpurpose>Gets the value of a configuration option</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>ini_get</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns the value of the configuration option on success, an
|
|
empty string on failure.
|
|
</para>
|
|
<para>
|
|
See also <function>get_cfg_var</function>,
|
|
<function>ini_get_all</function>,
|
|
<function>ini_alter</function>,
|
|
<function>ini_restore</function>, and
|
|
<function>ini_set</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ini-get-all">
|
|
<refnamediv>
|
|
<refname>ini_get_all</refname>
|
|
<refpurpose>Gets all configuration options</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>ini_get_all</methodname>
|
|
<methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns all the registered configuration options as an
|
|
associative array. If optional <parameter>extension</parameter>
|
|
parameter is set, returns only options specific for that
|
|
extension.
|
|
</para>
|
|
<para>
|
|
See also: <function>ini_alter</function>,
|
|
<function>ini_restore</function>, <function>ini_get</function>,
|
|
and <function>ini_set</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ini-restore">
|
|
<refnamediv>
|
|
<refname>ini_restore</refname>
|
|
<refpurpose>Restores the value of a configuration option</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>ini_restore</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Restores a given configuration option to its original value.
|
|
</para>
|
|
<para>
|
|
See also: <function>ini_alter</function>,
|
|
<function>ini_get</function>, <function>ini_get_all</function>,
|
|
and <function>ini_set</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ini-set">
|
|
<refnamediv>
|
|
<refname>ini_set</refname>
|
|
<refpurpose>Sets the value of a configuration option</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>ini_set</methodname>
|
|
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>newvalue</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Sets the value of the given configuration option. Returns the old
|
|
value on success, &false; on failure. The configuration option
|
|
will keep this new value during the script's execution, and will
|
|
be restored at the script's ending.
|
|
</para>
|
|
<para>
|
|
Not all the available options can be changed using
|
|
<function>ini_set</function>. Below is a table with a list of all
|
|
PHP options (as of PHP 4.0.5), indicating which ones can be
|
|
changed/set and at what level.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title><link linkend="configuration">Configuration</link> options</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Name</entry>
|
|
<entry>Default</entry>
|
|
<entry>Changeable</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>allow_call_time_pass_reference</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM|PHP_INI_PERDIR</entry>
|
|
</row>
|
|
<row>
|
|
<entry>allow_url_fopen</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>arg_separator</entry>
|
|
<entry>"&"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>asp_tags</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM|PHP_INI_PERDIR</entry>
|
|
</row>
|
|
<row>
|
|
<entry>auto_append_file</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>auto_prepend_file</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>browscap</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>default_charset</entry>
|
|
<entry>SAPI_DEFAULT_CHARSET</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>default_mimetype</entry>
|
|
<entry>SAPI_DEFAULT_MIMETYPE</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>define_syslog_variables</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>disable_functions</entry>
|
|
<entry>""</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>display_errors</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>display_startup_errors</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>doc_root</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>enable_dl</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>error_append_string</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>error_log</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>error_prepend_string</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>error_reporting</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>expose_php</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>extension_dir</entry>
|
|
<entry>PHP_EXTENSION_DIR</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>file_uploads</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>gpc_order</entry>
|
|
<entry>"GPC"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.bg</entry>
|
|
<entry>HL_BG_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.comment</entry>
|
|
<entry>HL_COMMENT_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.default</entry>
|
|
<entry>HL_DEFAULT_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.html</entry>
|
|
<entry>HL_HTML_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.keyword</entry>
|
|
<entry>HL_KEYWORD_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>highlight.string</entry>
|
|
<entry>HL_STRING_COLOR</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>html_errors</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>ignore_user_abort</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>include_path</entry>
|
|
<entry>PHP_INCLUDE_PATH</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>implicit_flush</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>log_errors</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>magic_quotes_gpc</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>magic_quotes_runtime</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>magic_quotes_sybase</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>max_execution_time</entry>
|
|
<entry>"30"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>memory_limit</entry>
|
|
<entry>"8M"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>open_basedir</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>output_buffering</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>output_handler</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>post_max_size</entry>
|
|
<entry>"8M"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>precision</entry>
|
|
<entry>"14"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>register_argc_argv</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>register_globals</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_PERDIR|PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>safe_mode</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>safe_mode_exec_dir</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>sendmail_from</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>sendmail_path</entry>
|
|
<entry>DEFAULT_SENDMAIL_PATH</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>short_open_tag</entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM|PHP_INI_PERDIR</entry>
|
|
</row>
|
|
<row>
|
|
<entry>SMTP</entry>
|
|
<entry>"localhost"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>sql.safe_mode</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>track_errors</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>upload_max_filesize</entry>
|
|
<entry>"2M"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>upload_tmp_dir</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>user_dir</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
</row>
|
|
<row>
|
|
<entry>variables_order</entry>
|
|
<entry>&null;</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
<row>
|
|
<entry>y2k_compliance</entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Definition of PHP_INI_* constants</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Constant</entry>
|
|
<entry>Value</entry>
|
|
<entry>Meaning</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>PHP_INI_USER</entry>
|
|
<entry>1</entry>
|
|
<entry>Entry can be set in user scripts</entry>
|
|
</row>
|
|
<row>
|
|
<entry>PHP_INI_PERDIR</entry>
|
|
<entry>2</entry>
|
|
<entry>
|
|
Entry can be set in <filename>.htaccess</filename>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry>4</entry>
|
|
<entry>
|
|
Entry can be set in &php.ini; or
|
|
<filename>httpd.conf</filename>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>PHP_INI_ALL</entry>
|
|
<entry>7</entry>
|
|
<entry>Entry can be set anywhere</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
See also: <function>ini_alter</function>,
|
|
<function>ini_get</function>, and
|
|
<function>ini_restore</function>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.phpcredits">
|
|
<refnamediv>
|
|
<refname>phpcredits</refname>
|
|
<refpurpose>Prints out the credits for PHP</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>phpcredits</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>flag</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function prints out the credits listing the PHP developers,
|
|
modules, etc. It generates the appropriate HTML codes to insert
|
|
the information in a page. <parameter>flag</parameter> is
|
|
optional, and it defaults to <constant>CREDITS_ALL</constant>.
|
|
To generate a custom credits page, you may want to use the
|
|
<parameter>flag</parameter> parameter. For example to print
|
|
the general credits, you will use somewhere in your code:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
...
|
|
phpcredits(CREDITS_GENERAL);
|
|
...
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
And if you want to print the core developers and the
|
|
documentation group, in a page of its own, you will use:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
And if you feel like embedding all the credits in your page, then
|
|
code like the one below will do it:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<html>
|
|
<head>
|
|
<title>My credits page</title>
|
|
</head>
|
|
<body>
|
|
<?php
|
|
// some code of your own
|
|
phpcredits(CREDITS_ALL);
|
|
// some more code
|
|
?>
|
|
</body>
|
|
</html>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Pre-defined <function>phpcredits</function> flags</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>name</entry>
|
|
<entry>description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>CREDITS_ALL</entry>
|
|
<entry>
|
|
All the credits, equivalent to using: CREDITS_DOCS +
|
|
CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES +
|
|
CREDITS_FULLPAGE. It generates a complete stand-alone HTML
|
|
page with the appropriate tags.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_DOCS</entry>
|
|
<entry>The credits for the documentation team</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_FULLPAGE</entry>
|
|
<entry>
|
|
Usually used in combination with the other flags. Indicates
|
|
that the a complete stand-alone HTML page needs to be
|
|
printed including the information indicated by the other
|
|
flags.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_GENERAL</entry>
|
|
<entry>
|
|
General credits: Language design and concept, PHP 4.0
|
|
authors and SAPI module.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_GROUP</entry>
|
|
<entry>A list of the core developers</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_MODULES</entry>
|
|
<entry>
|
|
A list of the extension modules for PHP, and their authors
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>CREDITS_SAPI</entry>
|
|
<entry>
|
|
A list of the server API modules for PHP, and their authors
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
See also: <function>phpinfo</function>,
|
|
<function>phpversion</function>, and
|
|
<function>php_logo_guid</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.phpinfo">
|
|
<refnamediv>
|
|
<refname>phpinfo</refname>
|
|
<refpurpose>Outputs lots of PHP information</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>phpinfo</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>what</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Outputs a large amount of information about the current state of
|
|
PHP. This includes information about PHP compilation options and
|
|
extensions, the PHP version, server information and environment
|
|
(if compiled as a module), the PHP environment, OS version
|
|
information, paths, master and local values of configuration
|
|
options, HTTP headers, and the PHP License.
|
|
</para>
|
|
<para>
|
|
Because every system is setup differently,
|
|
<function>phpinfo</function> is commonly used to check <link
|
|
linkend="configuration">configuration settings</link> and for
|
|
available <link
|
|
linkend="language.variables.predefined">predefined
|
|
variables</link> on a given system. Also,
|
|
<function>phpinfo</function> is a valuable debugging tool as it
|
|
contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
|
|
</para>
|
|
<para>
|
|
The output may be customized by passing one or more of the
|
|
following <emphasis>constants</emphasis> bitwise values summed
|
|
together in the optional <parameter>what</parameter> parameter.
|
|
One can also combine the respective constants or bitwise values
|
|
together with the <link
|
|
linkend="language.operators.bitwise">or</link> operator.
|
|
|
|
<table>
|
|
<title><function>phpinfo</function> options</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Name (constant)</entry>
|
|
<entry>Value</entry>
|
|
<entry>Description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>INFO_GENERAL</entry>
|
|
<entry>1</entry>
|
|
<entry>
|
|
The configuration line, &php.ini; location, build date, Web
|
|
Server, System and more.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_CREDITS</entry>
|
|
<entry>2</entry>
|
|
<entry>
|
|
PHP 4 Credits. See also <function>phpcredits</function>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_CONFIGURATION</entry>
|
|
<entry>4</entry>
|
|
<entry>
|
|
Current Local and Master values for php directives. See
|
|
also <function>ini_get</function>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_MODULES</entry>
|
|
<entry>8</entry>
|
|
<entry>
|
|
Loaded modules and their respective settings.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_ENVIRONMENT</entry>
|
|
<entry>16</entry>
|
|
<entry>
|
|
Environment Variable information that's also available in
|
|
<varname>$_ENV</varname>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_VARIABLES</entry>
|
|
<entry>32</entry>
|
|
<entry>
|
|
Shows all <link linkend="language.variables.predefined">
|
|
predefined variables</link> from EGPCS (Environment, GET,
|
|
POST, Cookie, Server).
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_LICENSE</entry>
|
|
<entry>64</entry>
|
|
<entry>
|
|
PHP License information. See also the <ulink
|
|
url="&url.php.license;">license faq</ulink>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>INFO_ALL</entry>
|
|
<entry>-1</entry>
|
|
<entry>
|
|
Shows all of the above. This is the default value.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>phpinfo</function> examples</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// Show all information, defaults to INFO_ALL
|
|
phpinfo();
|
|
|
|
// Show just the module information.
|
|
// phpinfo(8) yields identical results.
|
|
phpinfo(INFO_MODULES);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Parts of the information displayed are disabled when the
|
|
<literal>expose_php</literal> configuration setting is set to
|
|
<literal>off</literal>. This includes the PHP and Zend logos,
|
|
and the credits.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also: <function>phpversion</function>,
|
|
<function>phpcredits</function>,
|
|
<function>php_logo_guid</function>, <function>ini_get</function>,
|
|
<function>ini_set</function>, and the section on <link
|
|
linkend="language.variables.predefined">Predefined
|
|
Variables</link>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.phpversion">
|
|
<refnamediv>
|
|
<refname>phpversion</refname>
|
|
<refpurpose>Gets the current PHP version</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>phpversion</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns a string containing the version of the currently running
|
|
PHP parser.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This information is also available in the predefined constant
|
|
<constant>PHP_VERSION</constant>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>phpversion</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// prints e.g. 'Current PHP version: 4.1.1'
|
|
echo 'Current PHP version: ' . phpversion();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>version_compare</function>,
|
|
<function>phpinfo</function>, <function>phpcredits</function>,
|
|
<function>php_logo_guid</function>, and
|
|
<function>zend_version</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.php-logo-guid">
|
|
<refnamediv>
|
|
<refname>php_logo_guid</refname>
|
|
<refpurpose>Gets the logo guid</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>php_logo_guid</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<note>
|
|
<para>
|
|
This functionality was added in PHP 4.0.0.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also: <function>phpinfo</function>,
|
|
<function>phpversion</function>, and
|
|
<function>phpcredits</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.php-sapi-name">
|
|
<refnamediv>
|
|
<refname>php_sapi_name</refname>
|
|
<refpurpose>
|
|
Returns the type of interface between web server and PHP
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>php_sapi_name</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
<function>php_sapi_name</function> returns a lowercase string
|
|
which describes the type of interface between web server and PHP
|
|
(Server API, SAPI). In CGI PHP, this string is "cgi", in mod_php
|
|
for Apache, this string is "apache" and so on.
|
|
</simpara>
|
|
<para>
|
|
<example>
|
|
<title><function>php_sapi_name</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$sapi_type = php_sapi_name();
|
|
if ($sapi_type == "cgi")
|
|
print "You are using CGI PHP\n";
|
|
else
|
|
print "You are not using CGI PHP\n";
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.php-uname">
|
|
<refnamediv>
|
|
<refname>php_uname</refname>
|
|
<refpurpose>
|
|
Returns information about the operating system PHP was built on
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>php_uname</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
<function>php_uname</function> returns a string with a
|
|
description of the operating system PHP is built on.
|
|
</simpara>
|
|
<para>
|
|
<example>
|
|
<title><function>php_uname</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
if (substr(php_uname(), 0, 7) == "Windows") {
|
|
die ("Sorry, this script doesn't run on Windows.\n");
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.putenv">
|
|
<refnamediv>
|
|
<refname>putenv</refname>
|
|
<refpurpose>Sets the value of an environment variable</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>putenv</methodname>
|
|
<methodparam><type>string</type><parameter>setting</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Adds <parameter>setting</parameter> to the server environment.
|
|
The environment variable will only exist for the duration of the
|
|
current request. At the end of the request the environment is
|
|
restored to its original state.
|
|
</para>
|
|
<para>
|
|
Setting certain environment variables may be a potential security
|
|
breach. The <literal>safe_mode_allowed_env_vars</literal>
|
|
directive contains a comma-delimited list of prefixes. In Safe
|
|
Mode, the user may only alter environment variables whose names
|
|
begin with the prefixes supplied by this directive. By default,
|
|
users will only be able to set environment variables that begin
|
|
with <literal>PHP_</literal>
|
|
(e.g. <literal>PHP_FOO=BAR</literal>). Note: if this directive is
|
|
empty, PHP will let the user modify ANY environment variable!
|
|
</para>
|
|
<para>
|
|
The <literal>safe_mode_protected_env_vars</literal> directive
|
|
contains a comma-delimited list of environment variables, that
|
|
the end user won't be able to change using
|
|
<function>putenv</function>. These variables will be protected
|
|
even if <literal>safe_mode_allowed_env_vars</literal> is set to
|
|
allow to change them.
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
These directives have only effect when <link
|
|
linkend="features.safe-mode">safe-mode</link> itself is enabled!
|
|
</para>
|
|
</warning>
|
|
<para>
|
|
<example>
|
|
<title>Setting an Environment Variable</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
putenv ("UNIQID=$uniqid");
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>getenv</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.set-magic-quotes-runtime">
|
|
<refnamediv>
|
|
<refname>set_magic_quotes_runtime</refname>
|
|
<refpurpose>
|
|
Sets the current active configuration setting of
|
|
magic_quotes_runtime
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>long</type><methodname>set_magic_quotes_runtime</methodname>
|
|
<methodparam><type>int</type><parameter>new_setting</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Set the current active configuration setting of <link
|
|
linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link> (0
|
|
for off, 1 for on).
|
|
</simpara>
|
|
<simpara>
|
|
See also: <function>get_magic_quotes_gpc</function> and
|
|
<function>get_magic_quotes_runtime</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.set-time-limit">
|
|
<refnamediv>
|
|
<refname>set_time_limit</refname>
|
|
<refpurpose>Limits the maximum execution time</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>set_time_limit</methodname>
|
|
<methodparam><type>int</type><parameter>seconds</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Set the number of seconds a script is allowed to run. If this is
|
|
reached, the script returns a fatal error. The default limit is
|
|
30 seconds or, if it exists, the
|
|
<literal>max_execution_time</literal> value defined in the <link
|
|
linkend="ini.max-execution-time">configuration file</link>. If
|
|
seconds is set to zero, no time limit is imposed.
|
|
</simpara>
|
|
<simpara>
|
|
When called, <function>set_time_limit</function> restarts the
|
|
timeout counter from zero. In other words, if the timeout is the
|
|
default 30 seconds, and 25 seconds into script execution a call
|
|
such as set_time_limit(20) is made, the script will run for a
|
|
total of 45 seconds before timing out.
|
|
</simpara>
|
|
<simpara>
|
|
<function>set_time_limit</function> has no effect when PHP is
|
|
running in safe mode. There is no workaround other than turning
|
|
off safe mode or changing the time limit in the <link
|
|
linkend="ini.max-execution-time">configuration file</link>.
|
|
</simpara>
|
|
<note>
|
|
<para>
|
|
The <function>set_time_limit</function> function and the
|
|
configuration directive <link
|
|
linkend="ini.max-execution-time">max_execution_time</link> only
|
|
affect the execution time of the script itself. Any time spent
|
|
on activity that happens outside the execution of the script
|
|
such as system calls using <function>system</function>, the
|
|
<function>sleep</function> function, database queries, etc. is
|
|
not included when determining the maximum time that the script
|
|
has been running.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.version-compare">
|
|
<refnamediv>
|
|
<refname>version_compare</refname>
|
|
<refpurpose>
|
|
Compares two "PHP-standardized" version number strings
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>version_compare</methodname>
|
|
<methodparam><type>string</type><parameter>version1</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>version2</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>
|
|
operator
|
|
</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>version_compare</function> compares two
|
|
"PHP-standardized" version number strings. This is useful if you
|
|
would like to write programs working only on some versions of
|
|
PHP.
|
|
</para>
|
|
<para>
|
|
<function>version_compare</function> returns -1 if the first
|
|
version is lower than the second, 0 if they are equal, and +1 if
|
|
the second is lower.
|
|
</para>
|
|
<para>
|
|
If you specify the third optional <parameter>operator</parameter>
|
|
argument, you can test for a particular relationship. The
|
|
possible operators are: <literal><</literal>,
|
|
<literal>lt</literal>, <literal><=</literal>,
|
|
<literal>le</literal>, <literal>></literal>,
|
|
<literal>gt</literal>, <literal>>=</literal>,
|
|
<literal>ge</literal>, <literal>==</literal>,
|
|
<literal>=</literal>, <literal>eq</literal>,
|
|
<literal>!=</literal>, <literal><></literal>,
|
|
<literal>ne</literal> respectively. Using this argument, the
|
|
function will return 1 if the relationship is the one specified
|
|
by the operator, 0 otherwise.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>version_compare</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
// prints -1
|
|
echo version_compare("4.0.4", "4.0.6");
|
|
|
|
// these all print 1
|
|
echo version_compare("4.0.4", "4.0.6", "<");
|
|
echo version_compare("4.0.6", "4.0.6", "eq");
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zend-logo-guid">
|
|
<refnamediv>
|
|
<refname>zend_logo_guid</refname>
|
|
<refpurpose>Gets the zend guid</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>zend_logo_guid</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<note>
|
|
<para>
|
|
This functionality was added in PHP 4.0.0.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.zend-version">
|
|
<refnamediv>
|
|
<refname>zend_version</refname>
|
|
<refpurpose>Gets the version of the current Zend engine</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>zend_version</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns a string containing the version of the currently running
|
|
PHP parser.
|
|
<example>
|
|
<title><function>zend_version</function> Example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
// prints e.g. 'Zend engine version: 1.0.4'
|
|
echo "Zend engine version: " . zend_version();
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>phpinfo</function>,
|
|
<function>phpcredits</function>,
|
|
<function>php_logo_guid</function>, and
|
|
<function>phpversion</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|