Configure system Constants
1. Check and configure these preferences when the file system is working.
When the file system is running, these default values will increase the security of the system. However, when the underlying layer of php or apache separately opens a process for each user, the octal value is always correct.
FILE_READ_MODE: file reading mode
FILE_WRITE_MODE: file writing mode
DIR_READ_MODE: Directory reading mode
DIR_WRITE_MODE: Directory writing mode
2. file stream mode
These modes are required when we use fopen ()/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 ('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 ');
File Source Code:Copy codeThe Code is as follows: [php]
<? Php if (! Defined ('basepath') exit ('no direct script access allowed ');
/*
| --------------------------------------------------------------------------
| File and Directory Modes
| --------------------------------------------------------------------------
| 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 shold
| 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 );
/*
| --------------------------------------------------------------------------
| File Stream Modes File Stream mode
| --------------------------------------------------------------------------
| 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 */