Configure system constants 1. When the file system is working, check and configure these preferences. When the file system is running, these default values will properly increase the security of the system, however, when the underlying layer of php or apache separately opens a process for each user, the value of "8 bytes" is always the correct FILE_READ_MODE for reading files. FILE_WRITE_MODE for writing files. DIR_READ_MODE for reading directories. DIR_WRITE_MODE for writing to directories. 2. file stream mode when fopen () is used () /In popen (), define ('fopen _ read', 'rb'); define ('fopen _ READ_WRITE ', 'r + B '); define ('fopen _ WRITE_CREATE_DESTRUCTIVE ', 'wb'); define ('fopen _ READ_WRITE_CREATE_DESTRUCTIVE', 'W + B '); define ('fop EN_WRITE_CREATE ',' AB '); define ('fopen _ READ_WRITE_CREATE', 'a + B '); define ('fopen _ WRITE_CREATE_STRICT', 'xb '); define ('fopen _ READ_WRITE_CREATE_STRICT ', 'x + B'); file source code: [php] <? Php if (! Defined ('basepath') exit ('no direct script access allowed '); /* | delimiter | File and Directory Modes | percent | These prefs console, preferences are used when checking and setting modes when working | with the file system. the defaults are fine on servers with proper | security, but you may wish (or even need) to change the values in | certain environments (Apache running a separate process for each | user, PHP under CGI with Apache suEXEC, etc .). octal values shocould | always be used to set the mode correctly. | */define ('file _ READ_MODE ', 0644); define ('file _ WRITE_MODE', 0666); define ('dir _ READ_MODE ', 0755 ); define ('dir _ WRITE_MODE ', 0777);/* | usage | File Stream Modes File Stream mode | usage | These modes are used when working with fopen ()/popen () | */define ('fopen _ read', 'rb'); define ('fopen _ READ_WRITE ', 'r + B'); define ('fopen _ WRITE_CREATE_DESTRUCTIVE ', 'wb'); // truncates existing file data, use with care define ('fopen _ read_write_create_destructive', 'W + B '); // truncates existing file data, use with care define ('fopen _ WRITE_CREATE ',' AB '); define ('fopen _ READ_WRITE_CREATE', 'a + B '); define ('fopen _ WRITE_CREATE_STRICT ', 'xb '); define ('fopen _ READ_WRITE_CREATE_STRICT', 'x + B ');/* End of file constants. php * // * Location :. /application/config/constants. php */