<HTML ><HEAD ><TITLE >Filesystem functions</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="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="filepro" HREF="function.filepro.html"><LINK REL="NEXT" TITLE="basename" HREF="function.basename.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" 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.filepro.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.basename.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.filesystem" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XXX. Filesystem functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN24856" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.intro" ></A >Introduction</H1 ><P > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.requirements" ></A >Requirements</H1 ><P >No external libraries are needed to build this extension.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.installation" ></A >Installation</H1 ><P >There is no installation needed to use these functions; they are part of the PHP core.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.configuration" ></A >Runtime Configuration</H1 ><P > The behaviour of these functions is affected by settings in <TT CLASS="filename" >php.ini</TT >. </P ><P > <DIV CLASS="table" ><A NAME="AEN24871" ></A ><P ><B >Table 1. Filesystem and Streams Configuration Options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Name</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Default</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Changeable</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >allow_url_fopen</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >"1"</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >user_agent</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >NULL</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >default_socket_timeout</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >"60"</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >from</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >NULL</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >??</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >auto_detect_line_endings</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >"Off"</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > Here is a short explanation of the configuration directives. <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><A NAME="ini.allow-url-fopen" ></A ><TT CLASS="parameter" ><I >allow_url_fopen</I ></TT > <A HREF="language.types.boolean.html" ><B CLASS="type" >boolean</B ></A ></DT ><DD ><P > This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of <A HREF="features.remote-files.html" >remote files</A > using the ftp or http protocol, some extensions like <A HREF="ref.zlib.html" >zlib</A > may register additional wrappers. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > This option was introduced immediately after the release of version 4.0.3. For versions up to and including 4.0.3 you can only disable this feature at compile time by using the configuration switch <A HREF="install.configure.html#install.configure.disable-url-fopen-wrapper" ><TT CLASS="parameter" ><I > --disable-url-fopen-wrapper</I ></TT ></A >. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > On Windows versions prior to PHP 4.3, the following functions do not support remote file accesing: <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A >, <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A >, <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A >, <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > and the imagecreatefromXXX functions in the <A HREF="ref.image.html" >Reference XLI, <I >Image functions</I ></A > extension. </P ></TD ></TR ></TABLE ></DIV ></DD ><DT ><A NAME="ini.user-agent" ></A ><TT CLASS="parameter" ><I >user_agent</I ></TT > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > Define the user agent for <TT CLASS="literal" >PHP</TT > to send. </P ></DD ><DT ><A NAME="ini.default-socket-timeout" ></A ><TT CLASS="parameter" ><I >default_socket_timeout</I ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > Default timeout (in seconds) for socket based streams. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > This configuration option was introduced in PHP 4.3. </P ></BLOCKQUOTE ></DIV ></DD ><DT ><A NAME="ini.from" ></A ><TT CLASS="parameter" ><I >from="joe@example.com"</I ></TT > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > Define the anonymous ftp password (your email address). </P ></DD ><DT ><A NAME="ini.auto-detect-line-endings" ></A ><TT CLASS="parameter" ><I >auto_detect_line_endings</I ></TT > <A HREF="language.types.boolean.html" ><B CLASS="type" >boolean</B ></A ></DT ><DD ><P > When turned on, PHP will examine the data read by <A HREF="function.fgets.html" ><B CLASS="function" >fgets()</B ></A > and <A HREF="function.file.html" ><B CLASS="function" >file()</B ></A > to see if it is using Unix, MS-Dos or Macintosh line-ending conventions. </P ><P >This enables PHP to interoperate with Macintosh systems, but defaults to Off, as there is a very small performance penalty when detecting the EOL conventions for the first line, and also because people using carriage-returns as item separators under Unix systems would experience non-backwards-compatible behaviour. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > This configuration option was introduced in PHP 4.3. </P ></BLOCKQUOTE ></DIV ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.resources" ></A >Resource Types</H1 ><P > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.constants" ></A >Predefined Constants</H1 ><P >This extension has no constants defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="filesystem.seealso" ></A >See Also</H1 ><P > For related functions, see also the <A HREF="ref.dir.html" >Directory</A > and <A HREF="ref.exec.html" >Program Execution</A > sections. </P ><P > For a list and explanation of the various URL wrappers that can be used as remote files, see also <A HREF="wrappers.html" >Appendix I</A >. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.basename.html" >basename</A > -- Returns filename component of path</DT ><DT ><A HREF="function.chgrp.html" >chgrp</A > -- Changes file group</DT ><DT ><A HREF="function.chmod.html" >chmod</A > -- Changes file mode</DT ><DT ><A HREF="function.chown.html" >chown</A > -- Changes file owner</DT ><DT ><A HREF="function.clearstatcache.html" >clearstatcache</A > -- Clears file status cache</DT ><DT ><A HREF="function.copy.html" >copy</A > -- Copies file</DT ><DT ><A HREF="function.delete.html" >delete</A > -- See <A HREF="function.unlink.html" ><B CLASS="function" >unlink()</B ></A > or <A HREF="function.unset.html" ><B CLASS="function" >unset()</B ></A ></DT ><DT ><A HREF="function.dirname.html" >dirname</A > -- Returns directory name component of path</DT ><DT ><A HREF="function.disk-free-space.html" >disk_free_space</A > -- Returns available space in directory</DT ><DT ><A HREF="function.disk-total-space.html" >disk_total_space</A > -- Returns the total size of a directory</DT ><DT ><A HREF="function.diskfreespace.html" >diskfreespace</A > -- Alias of <A HREF="function.disk-free-space.html" ><B CLASS="function" >disk_free_space()</B ></A ></DT ><DT ><A HREF="function.fclose.html" >fclose</A > -- Closes an open file pointer</DT ><DT ><A HREF="function.feof.html" >feof</A > -- Tests for end-of-file on a file pointer</DT ><DT ><A HREF="function.fflush.html" >fflush</A > -- Flushes the output to a file</DT ><DT ><A HREF="function.fgetc.html" >fgetc</A > -- Gets character from file pointer</DT ><DT ><A HREF="function.fgetcsv.html" >fgetcsv</A > -- Gets line from file pointer and parse for CSV fields</DT ><DT ><A HREF="function.fgets.html" >fgets</A > -- Gets line from file pointer</DT ><DT ><A HREF="function.fgetss.html" >fgetss</A > -- Gets line from file pointer and strip HTML tags</DT ><DT ><A HREF="function.file-exists.html" >file_exists</A > -- Checks whether a file exists</DT ><DT ><A HREF="function.file-get-contents.html" >file_get_contents</A > -- Reads entire file into a string</DT ><DT ><A HREF="function.file.html" >file</A > -- Reads entire file into an array</DT ><DT ><A HREF="function.fileatime.html" >fileatime</A > -- Gets last access time of file</DT ><DT ><A HREF="function.filectime.html" >filectime</A > -- Gets inode change time of file</DT ><DT ><A HREF="function.filegroup.html" >filegroup</A > -- Gets file group</DT ><DT ><A HREF="function.fileinode.html" >fileinode</A > -- Gets file inode</DT ><DT ><A HREF="function.filemtime.html" >filemtime</A > -- Gets file modification time</DT ><DT ><A HREF="function.fileowner.html" >fileowner</A > -- Gets file owner</DT ><DT ><A HREF="function.fileperms.html" >fileperms</A > -- Gets file permissions</DT ><DT ><A HREF="function.filesize.html" >filesize</A > -- Gets file size</DT ><DT ><A HREF="function.filetype.html" >filetype</A > -- Gets file type</DT ><DT ><A HREF="function.flock.html" >flock</A > -- Portable advisory file locking</DT ><DT ><A HREF="function.fnmatch.html" >fnmatch</A > -- Match filename against a pattern</DT ><DT ><A HREF="function.fopen.html" >fopen</A > -- Opens file or URL</DT ><DT ><A HREF="function.fpassthru.html" >fpassthru</A > -- Output all remaining data on a file pointer</DT ><DT ><A HREF="function.fputs.html" >fputs</A > -- Writes to a file pointer</DT ><DT ><A HREF="function.fread.html" >fread</A > -- Binary-safe file read</DT ><DT ><A HREF="function.fscanf.html" >fscanf</A > -- Parses input from a file according to a format</DT ><DT ><A HREF="function.fseek.html" >fseek</A > -- Seeks on a file pointer</DT ><DT ><A HREF="function.fstat.html" >fstat</A > -- Gets information about a file using an open file pointer</DT ><DT ><A HREF="function.ftell.html" >ftell</A > -- Tells file pointer read/write position</DT ><DT ><A HREF="function.ftruncate.html" >ftruncate</A > -- Truncates a file to a given length</DT ><DT ><A HREF="function.fwrite.html" >fwrite</A > -- Binary-safe file write</DT ><DT ><A HREF="function.glob.html" >glob</A > -- Find pathnames matching a pattern</DT ><DT ><A HREF="function.is-dir.html" >is_dir</A > -- Tells whether the filename is a directory</DT ><DT ><A HREF="function.is-executable.html" >is_executable</A > -- Tells whether the filename is executable</DT ><DT ><A HREF="function.is-file.html" >is_file</A > -- Tells whether the filename is a regular file</DT ><DT ><A HREF="function.is-link.html" >is_link</A > -- Tells whether the filename is a symbolic link</DT ><DT ><A HREF="function.is-readable.html" >is_readable</A > -- Tells whether the filename is readable</DT ><DT ><A HREF="function.is-uploaded-file.html" >is_uploaded_file</A > -- Tells whether the file was uploaded via HTTP POST</DT ><DT ><A HREF="function.is-writable.html" >is_writable</A > -- Tells whether the filename is writable</DT ><DT ><A HREF="function.is-writeable.html" >is_writeable</A > -- Tells whether the filename is writable</DT ><DT ><A HREF="function.link.html" >link</A > -- Create a hard link</DT ><DT ><A HREF="function.linkinfo.html" >linkinfo</A > -- Gets information about a link</DT ><DT ><A HREF="function.lstat.html" >lstat</A > -- Gives information about a file or symbolic link</DT ><DT ><A HREF="function.mkdir.html" >mkdir</A > -- Makes directory</DT ><DT ><A HREF="function.move-uploaded-file.html" >move_uploaded_file</A > -- Moves an uploaded file to a new location</DT ><DT ><A HREF="function.parse-ini-file.html" >parse_ini_file</A > -- Parse a configuration file</DT ><DT ><A HREF="function.pathinfo.html" >pathinfo</A > -- Returns information about a file path</DT ><DT ><A HREF="function.pclose.html" >pclose</A > -- Closes process file pointer</DT ><DT ><A HREF="function.popen.html" >popen</A > -- Opens process file pointer</DT ><DT ><A HREF="function.readfile.html" >readfile</A > -- Outputs a file</DT ><DT ><A HREF="function.readlink.html" >readlink</A > -- Returns the target of a symbolic link</DT ><DT ><A HREF="function.realpath.html" >realpath</A > -- Returns canonicalized absolute pathname</DT ><DT ><A HREF="function.rename.html" >rename</A > -- Renames a file</DT ><DT ><A HREF="function.rewind.html" >rewind</A > -- Rewind the position of a file pointer</DT ><DT ><A HREF="function.rmdir.html" >rmdir</A > -- Removes directory</DT ><DT ><A HREF="function.set-file-buffer.html" >set_file_buffer</A > -- Alias of <A HREF="function.stream-set-write-buffer.html" ><B CLASS="function" >stream_set_write_buffer()</B ></A ></DT ><DT ><A HREF="function.stat.html" >stat</A > -- Gives information about a file</DT ><DT ><A HREF="function.symlink.html" >symlink</A > -- Creates a symbolic link</DT ><DT ><A HREF="function.tempnam.html" >tempnam</A > -- Create file with unique file name</DT ><DT ><A HREF="function.tmpfile.html" >tmpfile</A > -- Creates a temporary file</DT ><DT ><A HREF="function.touch.html" >touch</A > -- Sets access and modification time of file</DT ><DT ><A HREF="function.umask.html" >umask</A > -- Changes the current umask</DT ><DT ><A HREF="function.unlink.html" >unlink</A > -- Deletes a file</DT ></DL ></DIV ></DIV ></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.filepro.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.basename.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >filepro</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >basename</TD ></TR ></TABLE ></DIV ></BODY ></HTML >