Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 187

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>chmod</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Filesystem functions"
HREF="ref.filesystem.html"><LINK
REL="PREVIOUS"
TITLE="chgrp"
HREF="function.chgrp.html"><LINK
REL="NEXT"
TITLE="chown"
HREF="function.chown.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.chgrp.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.chown.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.chmod"
></A
>chmod</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN25022"
></A
><P
>    (PHP 3, PHP 4 )</P
>chmod&nbsp;--&nbsp;Changes file mode</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN25025"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>chmod</B
> ( string filename, int mode)<BR
></BR
><P
>&#13;     Attempts to change the mode of the file specified by
     <TT
CLASS="parameter"
><I
>filename</I
></TT
> to that given in
     <TT
CLASS="parameter"
><I
>mode</I
></TT
>.
    </P
><P
>&#13;     Note that <TT
CLASS="parameter"
><I
>mode</I
></TT
> is not automatically
     assumed to be an octal value, so strings (such as "g+w") will
     not work properly. To ensure the expected operation,
     you need to prefix <TT
CLASS="parameter"
><I
>mode</I
></TT
> with a zero (0):
     <DIV
CLASS="informalexample"
><A
NAME="AEN25042"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>chmod ("/somedir/somefile", 755);   // decimal; probably incorrect   
chmod ("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect       
chmod ("/somedir/somefile", 0755);  // octal; correct value of mode</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><P
>&#13;     The <TT
CLASS="parameter"
><I
>mode</I
></TT
> parameter consists of three octal
     number components specifying access restrictions for the owner,
     the user group in which the owner is in, and to everybody else in
     this order. One component can be computed by adding up the needed
     permissions for that target user base. Number 1 means that you
     grant execute rights, number 2 means that you make the file
     writeable, number 4 means that you make the file readable. Add
     up these numbers to specify needed rights. You can also read more
     about modes on UNIX systems with 'man 1 chmod' and 'man 2 chmod'.
     <DIV
CLASS="informalexample"
><A
NAME="AEN25046"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// Read and write for owner, nothing for everybody else
chmod ("/somedir/somefile", 0600);

// Read and write for owner, read for everybody else
chmod ("/somedir/somefile", 0644);

// Everything for owner, read and execute for others
chmod ("/somedir/somefile", 0755);

// Everything for owner, read and execute for owner's group
chmod ("/somedir/somefile", 0750);</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><P
>&#13;     <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       The current user is the user under which PHP runs. It is
       probably not the same user you use for normal shell or FTP
       access.
      </P
></BLOCKQUOTE
></DIV
>
    </P
><P
>&#13;     Returns <TT
CLASS="constant"
><B
>TRUE</B
></TT
> on success or <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on failure.
    </P
><P
>&#13;     See also <A
HREF="function.chown.html"
><B
CLASS="function"
>chown()</B
></A
> and
     <A
HREF="function.chgrp.html"
><B
CLASS="function"
>chgrp()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.chgrp.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.chown.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>chgrp</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.filesystem.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>chown</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>