Chapter 3. PHP and Your Operating System

In This Chapter

  • Manipulating files

  • Using operating system commands on files

  • Transferring files from one machine to another

  • Reading and writing files

  • Swapping data with other programs

  • Using SQLite to store data in text files

This book describes using PHP and MySQL together to develop dynamic Web applications. PHP displays Web pages and interacts with MySQL to retrieve and store data for the application. For most Web applications, PHP needs to interact only with MySQL. However, a few situations require a Web application that's more complex. The Web application might need to interact with the operating system or with other software on your system.

A photo gallery is one Web application that might need to interact with your operating system. Your photo gallery might allow users to upload graphic files into your application. For such an application, you might need to manage the files that the users upload. You might need to rename them, move them, or delete them. You might need to know when the photos were uploaded or when they were last accessed. PHP provides all the features you need to manage your file system.

PHP also allows you to run any program that's on your computer, regardless of whether it's a PHP program. With PHP code, you can transfer files between computers by using FTP. You can store information in files other than databases. This chapter gives you the information you need to use PHP to do pretty much anything you can think of on ...

Get PHP & MySQL® Web Development All-in-One Desk Reference for Dummies® 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.