Chapter 17. Filesystem Access

In this lesson you will learn how to access a web server's filesystem by using PHP and how to read and write files from within a script.

Managing Files

Let's examine how PHP allows you to work with files stored on a web server's hard disk.

File Permissions

Before you can perform any filesystem access from PHP, you have to consider the permission settings for the files you want to work with. This section deals primarily with the file permissions system on Unix/Linux systems, but the same considerations apply to all platforms.

Usually your web server will be running under either the apache or nobody username, yet your web documents and PHP scripts will be owned by your actual system user. Unless the web server user has ...

Get Sams Teach Yourself PHP in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.