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

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@12656 c90b9560-bf6c-de11-be94-00142212c4b1
606 lines
18 KiB
Text
606 lines
18 KiB
Text
|
|
<reference id="ref.info">
|
|
<title>PHP options & information</title>
|
|
<titleabbrev>PHP options/info</titleabbrev>
|
|
|
|
<refentry id="function.error-log">
|
|
<refnamediv>
|
|
<refname>error_log</refname>
|
|
<refpurpose>send an error message somewhere</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>error_log</function></funcdef>
|
|
<paramdef>string <parameter>message</parameter></paramdef>
|
|
<paramdef>int <parameter>message_type</parameter></paramdef>
|
|
<paramdef>string <parameter><optional>destination</optional></parameter></paramdef>
|
|
<paramdef>string <parameter><optional>extra_headers</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Sends an error message to the web server's error log, a
|
|
<acronym>TCP</acronym> port or to a file. The first parameter,
|
|
<parameter>message</parameter>, is the error message that should
|
|
be logged. The second parameter,
|
|
<parameter>message_type</parameter> says where the message should
|
|
go:
|
|
<table>
|
|
<title><function>error_log</function> log types</title>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>
|
|
<parameter>message</parameter> is sent to PHP's system
|
|
logger, using the Operating System's system logging
|
|
mechanism or a file, depending on what the <link
|
|
linkend="ini.error-log">error_log</link> configuration
|
|
directive is set to.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>
|
|
<parameter>message</parameter> is sent by email to the
|
|
address in the <parameter>destination</parameter> parameter.
|
|
This is the only message type where the fourth parameter,
|
|
<parameter>extra_headers</parameter> is used. This message
|
|
type uses the same internal function as
|
|
<function>Mail</function> does.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>
|
|
<parameter>message</parameter> is sent through the PHP
|
|
debugging connection. This option is only available if
|
|
<link linkend="enable-debugger">remote debugging has been
|
|
enabled</link>. In this case, the
|
|
<parameter>destination</parameter> parameter specifies the
|
|
host name or IP address and optionally, port number, of the
|
|
socket receiving the debug information.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>
|
|
<parameter>message</parameter> is appended to the file
|
|
<parameter>destination</parameter>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
<para>
|
|
<example>
|
|
<title><function>error_log</function> examples</title>
|
|
<programlisting role=php>
|
|
// Send notification through the server log if we can not
|
|
// connect to the database.
|
|
if (!Ora_Logon($username, $password)) {
|
|
error_log("Oracle database not available!", 0);
|
|
}
|
|
|
|
// Notify administrator by email if we run out of FOO
|
|
if (!($foo = allocate_new_foo()) {
|
|
error_log("Big trouble, we're all out of FOOs!", 1,
|
|
"operator@mydomain.com");
|
|
}
|
|
|
|
// other ways of calling error_log():
|
|
error_log("You messed up!", 2, "127.0.0.1:7000");
|
|
error_log("You messed up!", 2, "loghost");
|
|
error_log("You messed up!", 3, "/var/tmp/my-errors.log");
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.error-reporting">
|
|
<refnamediv>
|
|
<refname>error_reporting</refname>
|
|
<refpurpose>set which PHP errors are reported</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>error_reporting</function></funcdef>
|
|
<paramdef>int <parameter><optional>level</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Sets PHP's error reporting level and returns the old level. The
|
|
error reporting level is a bitmask of the following values
|
|
(follow the links for the internal values to get their meanings):
|
|
<table>
|
|
<title><function>error_reporting</function> bit values</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>value</entry>
|
|
<entry>internal name</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry><link linkend="internal.e-error">E_ERROR</link></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><link linkend="internal.e-warning">E_WARNING</link></entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry><link linkend="internal.e-parse">E_PARSE</link></entry>
|
|
</row>
|
|
<row>
|
|
<entry>8</entry>
|
|
<entry><link linkend="internal.e-notice">E_NOTICE</link></entry>
|
|
</row>
|
|
<row>
|
|
<entry>16</entry>
|
|
<entry><link linkend="internal.e-core-error">E_CORE_ERROR</link></entry>
|
|
</row>
|
|
<row>
|
|
<entry>32</entry>
|
|
<entry><link linkend="internal.e-core-warning">E_CORE_WARNING</link></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</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>
|
|
<funcsynopsis>
|
|
<funcdef>bool <function>extension_loaded</function></funcdef>
|
|
<paramdef>string <parameter>name</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<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>.
|
|
<para>
|
|
See also <function>phpinfo</function>.
|
|
<note>
|
|
<para>
|
|
This function was added in 3.0.10.
|
|
</note>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getenv">
|
|
<refnamediv>
|
|
<refname>getenv</refname>
|
|
<refpurpose>Get the value of an environment variable</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>getenv</function></funcdef>
|
|
<paramdef>string <parameter>varname</parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Returns the value of the environment variable
|
|
<parameter>varname</parameter>, or false on an error.
|
|
|
|
<informalexample><programlisting>
|
|
$ip = getenv("REMOTE_ADDR"); // get the ip number of the user
|
|
</programlisting></informalexample>
|
|
|
|
<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="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI
|
|
specification</ulink>, specifically the <ulink
|
|
url="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">page on environmental
|
|
variables</ulink>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-cfg-var">
|
|
<refnamediv>
|
|
<refname>get_cfg_var</refname>
|
|
<refpurpose>Get the value of a PHP configuration option.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>get_cfg_var</function></funcdef>
|
|
<paramdef>string <parameter>varname</parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<simpara>
|
|
Returns the current value of the PHP configuration variable
|
|
specified by <parameter>varname</parameter>, or false if an error
|
|
occurs.
|
|
|
|
<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>
|
|
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.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-current-user">
|
|
<refnamediv>
|
|
<refname>get_current_user</refname>
|
|
<refpurpose>Get the name of the owner of the current PHP script.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>get_current_user</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<simpara>
|
|
Returns the name of the owner of the current PHP script.
|
|
|
|
<simpara>
|
|
See also <function>getmyuid</function>,
|
|
<function>getmypid</function>, <function>getmyinode</function>,
|
|
and <function>getlastmod</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-magic-quotes-gpc">
|
|
<refnamediv>
|
|
<refname>get_magic_quotes_gpc</refname>
|
|
<refpurpose>Get the current active configuration setting of magic quotes gpc.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>long <function>get_magic_quotes_gpc</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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>
|
|
See also <function>get_magic_quotes_runtime</function>,
|
|
<function>set_magic_quotes_runtime</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.get-magic-quotes-runtime">
|
|
<refnamediv>
|
|
<refname>get_magic_quotes_runtime</refname>
|
|
<refpurpose>Get the current active configuration setting of magic_quotes_runtime.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>long <function>get_magic_quotes_runtime</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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>
|
|
See also <function>get_magic_quotes_gpc</function>,
|
|
<function>set_magic_quotes_runtime</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getlastmod">
|
|
<refnamediv>
|
|
<refname>getlastmod</refname>
|
|
<refpurpose>Get time of last page modification.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>getlastmod</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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>
|
|
// 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>
|
|
See alse <function>date</function>,
|
|
<function>getmyuid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getmypid</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmyinode">
|
|
<refnamediv>
|
|
<refname>getmyinode</refname>
|
|
<refpurpose>Get the inode of the current script.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>getmyinode</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Returns the current script's inode, or false on error.
|
|
|
|
<para>
|
|
See also <function>getmyuid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmypid</function>, and
|
|
<function>getlastmod</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmypid">
|
|
<refnamediv>
|
|
<refname>getmypid</refname>
|
|
<refpurpose>Get PHP's process ID.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>getmypid</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Returns the current PHP process ID, or false on error.
|
|
|
|
<para>
|
|
Note that when running as a server module, separate invocations
|
|
of the script are not guaranteed to have distinct pids.
|
|
|
|
<para>
|
|
See also <function>getmyuid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getmyuid">
|
|
<refnamediv>
|
|
<refname>getmyuid</refname>
|
|
<refpurpose>Get PHP script owner's UID.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>getmyuid</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<simpara>
|
|
Returns the user ID of the current script, or false on error.
|
|
|
|
<simpara>
|
|
See also <function>getmypid</function>,
|
|
<function>get_current_user</function>,
|
|
<function>getmyinode</function>, and
|
|
<function>getlastmod</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.getrusage">
|
|
<refnamediv>
|
|
<refname>getrusage</refname>
|
|
<refpurpose>Get the current resource usages.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>array <function>getrusage</function></funcdef>
|
|
<paramdef>int <parameter><optional>who</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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.
|
|
|
|
All entries are accessible by using their documented field names.
|
|
|
|
<example>
|
|
<title>Getrusage Example</title>
|
|
<programlisting role="php">
|
|
$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 for more details.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.phpinfo">
|
|
<refnamediv>
|
|
<refname>phpinfo</refname>
|
|
<refpurpose>Output lots of PHP information.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>phpinfo</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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 GNU Public License.
|
|
|
|
<para>
|
|
See also <function>phpversion</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.phpversion">
|
|
<refnamediv>
|
|
<refname>phpversion</refname>
|
|
<refpurpose>Get the current PHP version.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>phpversion</function></funcdef>
|
|
<paramdef>void</paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Returns a string containing the version of the currently running
|
|
PHP parser.
|
|
|
|
<example>
|
|
<title>phpversion() example</title>
|
|
<programlisting>
|
|
// prints e.g. 'Current PHP version: 3.0rel-dev'
|
|
echo "Current PHP version: ".phpversion();
|
|
</programlisting>
|
|
</example>
|
|
|
|
<para>
|
|
See also <function>phpinfo</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.putenv">
|
|
<refnamediv>
|
|
<refname>putenv</refname>
|
|
<refpurpose>Set the value of an environment variable.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>void <function>putenv</function></funcdef>
|
|
<paramdef>string <parameter>setting</parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<para>
|
|
Adds <parameter>setting</parameter> to the environment.
|
|
<para>
|
|
<example>
|
|
<title>Setting an Environment Variable</title>
|
|
<programlisting>
|
|
putenv("UNIQID=$uniqid");
|
|
</programlisting>
|
|
</example>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.set-magic-quotes-runtime">
|
|
<refnamediv>
|
|
<refname>set_magic_quotes_runtime</refname>
|
|
<refpurpose>Set the current active configuration setting of magic_quotes_runtime.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>long <function>set_magic_quotes_runtime</function></funcdef>
|
|
<paramdef>int <parameter>new_setting</parameter></paramdef>
|
|
</funcsynopsis>
|
|
|
|
<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>
|
|
See also <function>get_magic_quotes_gpc</function>,
|
|
<function>get_magic_quotes_runtime</function>.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.set-time-limit">
|
|
<refnamediv>
|
|
<refname>set_time_limit</refname>
|
|
<refpurpose>limit the maximum execution time</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>void <function>set_time_limit</function></funcdef>
|
|
<paramdef>int <parameter>seconds</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<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 max_execution_time value defined in
|
|
the <link linkend="configuration.file">configuration file</link>.
|
|
If seconds is set to zero, no time limit is imposed.
|
|
|
|
<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.
|
|
|
|
</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
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
-->
|