php-doc-en/functions/nis.xml
Hartmut Holzgraefe 7839d91186 added DO NOT EDIT noctice to old english functions files,
removing the others


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78562 c90b9560-bf6c-de11-be94-00142212c4b1
2002-04-17 19:58:46 +00:00

437 lines
12 KiB
XML

<!-- D O N O T E D I T T H I S F I L E ! ! !
it is still here for historical reasons only
(as translators may need to check old revision diffs)
if you want to change things documented in this file
you should now edit the files found under en/reference
instead -->
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.22 $ -->
<reference id="ref.nis">
<title>YP/NIS Functions</title>
<titleabbrev>YP/NIS</titleabbrev>
<partintro>
<para>
NIS (formerly called Yellow Pages) allows network management of
important administrative files (e.g. the password file). For more
information refer to the NIS manpage and <ulink url="&url.nis;">
Introduction to YP/NIS</ulink>. There is also a book called <ulink
url="&url.nis.book;">Managing NFS and NIS</ulink> by Hal Stern.
</para>
<para>
To get these functions to work, you have to configure PHP with
<option role="configure">--with-yp</option>(PHP 3) or
<option role="configure">--enable-yp</option>(PHP 4).
</para>
</partintro>
<refentry id="function.yp-get-default-domain">
<refnamediv>
<refname>yp_get_default_domain</refname>
<refpurpose>Fetches the machine's default NIS domain</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>yp_get_default_domain</methodname>
<void/>
</methodsynopsis>
<para>
<function>yp_get_default_domain</function> returns the default
domain of the node or &false;. Can be used as the domain parameter
for successive NIS calls.
</para>
<para>
A NIS domain can be described a group of NIS maps. Every host
that needs to look up information binds itself to a certain
domain. Refer to the documents mentioned at the beginning for
more detailed information.
</para>
<para>
<example>
<title>Example for the default domain</title>
<programlisting role="php">
<![CDATA[
<?php
$domain = yp_get_default_domain();
echo "Default NIS domain is: " . $domain;
?>
]]>
</programlisting>
</example>
</para>
<!--
<para>
See also: <link linkend="function.yp-errno">yp_errno</link> and
<link linkend="function.yp-err-string">yp_err_string</link>
</para>
-->
</refsect1>
</refentry>
<refentry id="function.yp-order">
<refnamediv>
<refname>yp_order</refname>
<refpurpose>Returns the order number for a map</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>yp_order</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
</methodsynopsis>
<para>
<function>yp_order</function> returns the order number for a map
or &false;.
</para>
<para>
<example>
<title>Example for the NIS order</title>
<programlisting role="php">
<![CDATA[
<?php
$number = yp_order($domain,$mapname);
echo "Order number for this map is: " . $number;
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>yp-get-default-domain</function>.
<!--
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
-->
</para>
</refsect1>
</refentry>
<refentry id="function.yp-master">
<refnamediv>
<refname>yp_master</refname>
<refpurpose>
Returns the machine name of the master NIS server for a map
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>yp_master</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
</methodsynopsis>
<para>
<function>yp_master</function> returns the machine name of
the master NIS server for a map.
</para>
<para>
<example>
<title>Example for the NIS master</title>
<programlisting role="php">
<![CDATA[
<?php
$number = yp_master ($domain, $mapname);
echo "Master for this map is: " . $master;
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>yp-get-default-domain</function>.
<!--
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
-->
</para>
</refsect1>
</refentry>
<refentry id="function.yp-match">
<refnamediv>
<refname>yp_match</refname>
<refpurpose>Returns the matched line</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>yp_match</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
<function>yp_match</function> returns the value associated with
the passed key out of the specified map or &false;. This key must
be exact.</para>
<para>
<example>
<title>Example for NIS match</title>
<programlisting role="php">
<![CDATA[
<?php
$entry = yp_match ($domain, "passwd.byname", "joe");
echo "Matched entry is: " . $entry;
?>
]]>
</programlisting>
</example>
</para>
<para>
In this case this could be: joe:##joe:11111:100:Joe
User:/home/j/joe:/usr/local/bin/bash
</para>
<para>
See also <function>yp-get-default-domain</function>
<!--
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
-->
</para>
</refsect1>
</refentry>
<refentry id="function.yp-first">
<refnamediv>
<refname>yp_first</refname>
<refpurpose>
Returns the first key-value pair from the named map
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>yp_first</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
</methodsynopsis>
<para>
<function>yp_first</function> returns the first key-value
pair from the named map in the named domain, otherwise &false;.
</para>
<para>
<example>
<title>Example for the NIS first</title>
<programlisting role="php">
<![CDATA[
<?php
$entry = yp_first($domain, "passwd.byname");
$key = $entry ["key"];
$value = $entry ["value"];
echo "First entry in this map has key " . $key . " and value " . $value;
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>yp-get-default-domain</function>
<!--
<link linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
-->
</para>
</refsect1>
</refentry>
<refentry id="function.yp-next">
<refnamediv>
<refname>yp_next</refname>
<refpurpose>Returns the next key-value pair in the named
map.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>yp_next</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
<function>yp_next</function> returns the next key-value pair in
the named map after the specified key or &false;.
</para>
<para>
<example>
<title>Example for NIS next</title>
<programlisting role="php">
<![CDATA[
<?php
$entry = yp_next ($domain, "passwd.byname", "joe");
if (!$entry) {
echo "No more entries found\n";
<!-- echo yp_errno() . ": " . yp_err_string(); -->
}
$key = key ($entry);
echo "The next entry after joe has key " . $key
. " and value " . $entry[$key];
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>yp-get-default-domain</function>.
<!--
<link linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
-->
</para>
</refsect1>
</refentry>
<refentry id="function.yp-errno">
<refnamediv>
<refname>yp_errno</refname>
<refpurpose>
Returns the error code of the previous operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>yp_errno</methodname>
<void/>
</methodsynopsis>
<para>
<function>yp_errno</function> returns the error code of the
previous operation.
</para>
<para>
Possible errors are:
</para>
<para>
<simplelist>
<member>1 args to function are bad</member>
<member>2 RPC failure - domain has been unbound</member>
<member>3 can't bind to server on this domain</member>
<member>4 no such map in server's domain</member>
<member>5 no such key in map</member>
<member>6 internal yp server or client error</member>
<member>7 resource allocation failure</member>
<member>8 no more records in map database</member>
<member>9 can't communicate with portmapper</member>
<member>10 can't communicate with ypbind</member>
<member>11 can't communicate with ypserv</member>
<member>12 local domain name not set</member>
<member>13 yp database is bad</member>
<member>14 yp version mismatch</member>
<member>15 access violation</member>
<member>16 database busy</member>
</simplelist>
</para>
<para>
See also <function>yp_err_string</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.yp-err-string">
<refnamediv>
<refname>yp_err_string</refname>
<refpurpose>
Returns the error string associated with the previous operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>yp_err_string</methodname>
<void/>
</methodsynopsis>
<para>
<function>yp_err_string</function> returns the error message
associated with the previous operation. Useful to indicate what
exactly went wrong.
</para>
<para>
<example>
<title>Example for NIS errors</title>
<programlisting role="php">
<![CDATA[
<?php
echo "Error: " . yp_err_string();
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>yp_errno</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.yp-all'>
<refnamediv>
<refname>yp_all</refname>
<refpurpose>
Traverse the map and call a function on each entry
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>yp_all</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.yp-cat'>
<refnamediv>
<refname>yp_cat</refname>
<refpurpose>
Return an array containing the entire map
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>yp_cat</methodname>
<methodparam><type>string</type><parameter>domain</parameter></methodparam>
<methodparam><type>string</type><parameter>map</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</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
-->