1. Configure the PHP file directory
as a scripting language for server-side interpretation, PHP programs are placed in a directory that a server can access. You can generally configure it by modifying the Apache Httpd.conj, such as our sentence in the file:
alias/test/"d:brhpwebsitebrhp/" then enter in the browser-side: "Http://localhost/test/+PHP file name" To access the d:brhpwebsitebrhp/under the php file ; Visible the line is simply an alias for the directory where the php file is stored.
Second, you can also specify the DocumentRoot path to the directory where the server files are located, the following two lines in the Httpd.conj, where the path can be arbitrarily specified, your PHP files can also be placed in the directory, the server can also run them, such as "http ://localhost/+php filename ".
Generally, it's better to keep your PHP files in one place, and you can manage them more easily, while others are in another place.
DocumentRoot "c:/usr/bin/html/"
2. Index file for server-side directories
in Httpd.conj, there is one row: Directory Index index.html
The row specifies that the directory defaults to open file as index.html, and when a directory is accessed, the server automatically finds index.html and, if not, displays a list of all the files in the directory. The default open file can be changed to something else, such as INDEX.PHP3, and so on, but perhaps we have a lot of directories, whether it is to store pictures, text and other information, or store PHP files or other files directory, we do not want users to see the list of files in the directory, in the HTTPD.CONJ A. htacess file is specified in the file, which produces a directory index file, for example, we use WordPad to create a. htacess file:
#. htacess #
DirectoryIndex error_open.php br>
To create an error warning file:
# error_open.php #
Error_ open.php is a permission error warning file that places the 2 files in all protected directories and automatically turns to execute error_open.php when the user attempts to open the directory, displaying an error warning.
3. Directory Deletion clever implementation
As we know, there is a rename () function in PHP4 for/win32 that supports renaming directories/files, such as: Rename (OldPath, NewPath)//OldPath The original path to the file or directory;//NewPath for the new defined path;
Realize the OldPath renamed to NewPath.
There is no function to delete the directory/file in the PHP4, how to delete it? As we know, there is a row in the php.ini that is used to complete the HTTP upload operation of the temporary file directory configuration line: upload_tmp_dir=;
PHP4 support the configuration of the temporary directory (PHP3 not supported), when the upload operation is completed, automatically empty the temporary directory, OK, with it we can skillfully implement file/directory deletion, such as setting: Upload_tmp_dir= "d:brhpwebsitebrhp/tmp/"; To delete a directory path, perform: tmp= "d:brhpwebsitebrhp/tmp/" rename (path, TMP)?>;
After the file or directory path is renamed TMP, all files/directories under the TMP directory are automatically cleared and the deletion is completed.