php-doc-en/functions/nis.sgml
cslawi 6998b1d731 Tiny typos.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9874 c90b9560-bf6c-de11-be94-00142212c4b1
1999-06-20 07:06:49 +00:00

373 lines
11 KiB
Text

<reference id="ref.nis">
<title>NIS functions</title>
<titleabbrev>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="http://www.desy.de/~sieversm/ypdoku/ypdoku/ypdoku.html">
Introduction to YP/NIS</ulink>. There is also a book called <ulink
url="http://www.oreilly.com/catalog/nfs/noframes.html">Managing
NFS and NIS</ulink> by Hal Stern.
<para>
To get these functions to work, you have to configure PHP with
<option role="configure">--with-yp</option>.
</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>
<funcsynopsis>
<funcdef>int <function>yp_get_default_domain</function></funcdef>
<paramdef>void <parameter></parameter></paramdef>
</funcsynopsis>
<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>
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>
<example>
<title>Example for the default domain</title>
<programlisting role="php">
&lt;?php
$domain = yp_get_default_domain();
if(!$domain) {
echo yp_errno() . ": " . yp_err_string();
}
echo "Default NIS domain is: " . $domain;
?>
</programlisting>
</example>
<para>
See also: <link linkend="function.yp-errno">yp_errno</link> and
<link linkend="function.yp-err-string">yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>int <function>yp_order</function></funcdef>
<paramdef>string <parameter>domain</parameter></paramdef>
<paramdef>string <parameter>map</parameter></paramdef>
</funcsynopsis>
<para>
<function>yp_order</function> returns the order number for a map
or FALSE.
<para>
<example>
<title>Example for the NIS order</title>
<programlisting role="php">
&lt;?php
$number = yp_order($domain,$mapname);
if(!$number) {
echo yp_errno() . ": " . yp_err_string();
}
echo "Order number for this map is: " . $order;
?>
</programlisting>
</example>
<para>
See also: <link linkend="function.yp-get-default-domain">
yp_get_default_domain</link> <link
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>string <function>yp_master</function></funcdef>
<paramdef>string <parameter>domain</parameter></paramdef>
<paramdef>string <parameter>map</parameter></paramdef>
</funcsynopsis>
<para>
<function>yp_master</function> returns the machine name of
the master NIS server for a map.
<para>
<example>
<title>Example for the NIS master</title>
<programlisting role="php">
&lt;?php
$number = yp_master($domain, $mapname);
if(!$number) {
echo yp_errno() . ": " . yp_err_string();
}
echo "Master for this map is: " . $master;
?>
</programlisting>
</example>
<para>
See also: <link linkend="function.yp-get-default-domain">
yp_get_default_domain</link> <link
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
</refsect1>
</refentry>
<refentry id="function.yp-match">
<refnamediv>
<refname>yp_match</refname>
<refpurpose>Returns the matched line.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>yp_match</function></funcdef>
<paramdef>string <parameter>domain</parameter></paramdef>
<paramdef>string <parameter>map</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcsynopsis>
<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>
<example>
<title>Example for NIS match</title>
<programlisting role=php>
&lt;?php
$entry = yp_match($domain, "passwd.byname", "joe");
if(!$entry) {
echo yp_errno() . ": " . yp_err_string();
}
echo "Matched entry is: " . $entry;
?>
</programlisting>
</example>
<para>
In this case this could be: joe:##joe:11111:100:Joe
User:/home/j/joe:/usr/local/bin/bash
<para>
See also: <link linkend="function.yp-get-default-domain">
yp_get_default_domain</link> <link
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>string[] <function>yp_first</function></funcdef>
<paramdef>string <parameter>domain</parameter></paramdef>
<paramdef>string <parameter>map</parameter></paramdef>
</funcsynopsis>
<para>
<function>yp_first</function> returns the first key-value
pair from the named map in the named domain, otherwise FALSE.
<para>
<example>
<title>Example for the NIS first</title>
<programlisting role="php">
&lt;?php
$entry = yp_first($domain, "passwd.byname");
if(!$entry) {
echo yp_errno() . ": " . yp_err_string();
}
$key = key($entry);
echo "First entry in this map has key " . $key
. " and value " . $entry[$key];
?>
</programlisting>
</example>
<para>
See also: <link linkend="function.yp-get-default-domain">
yp_get_default_domain</link> <link
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>string[] <function>yp_next</function></funcdef>
<paramdef>string <parameter>domain</parameter></paramdef>
<paramdef>string <parameter>map</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcsynopsis>
<para>
<function>yp_next</function> returns the next key-value pair in
the named map after the specified key or FALSE.
<para>
<example>
<title>Example for NIS next</title>
<programlisting role="php">
&lt;?php
$entry = yp_next($domain, "passwd.byname", "joe");
if(!$entry) {
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>
See also: <link linkend="function.yp-get-default-domain">
yp_get_default_domain</link>, <link
linkend="function.yp-errno">yp_errno</link> and <link
linkend="function.yp-err-string">yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>int <function>yp_errno</function></funcdef>
<paramdef></paramdef>
</funcsynopsis>
<para>
<function>yp_errno</function> returns the error code of the
previous operation.
<para>
Possible errors are:
<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>
See also: <link linkend="function.yp-err-string">
yp_err_string</link>
</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>
<funcsynopsis>
<funcdef>string <function>yp_err_string</function></funcdef>
<paramdef>void <parameter></parameter></paramdef>
</funcsynopsis>
<para>
<function>yp_err_string</function> returns the error message
associated with the previous operation. Useful to indicate what
exactly went wrong.
<para>
<example>
<title>Example for NIS errors</title>
<programlisting role="php">
&lt;?php
echo "Error: " . yp_err_string();
?>
</programlisting>
</example>
<para>
See also: <link linkend="function.yp-errno"> yp_errno</link>
</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:
-->