Today a client website suddenly reported a bunch of error prompts, prompting the code as follows:
Warning:session_start () [Function.session-start]: Open (/VAR/LIB/PHP/SESSION/SESS_0DJ5OL1FP235A0SCU79S8C33T1, O_ RDWR) Failed:permission denied (+) in/home/wethost/wwwroot/include/seccode.inc.php on line 7
Warning:Unknown:open (/VAR/LIB/PHP/SESSION/SESS_0DJ5OL1FP235A0SCU79S8C33T1, O_RDWR) Failed:permission denied (a) in Unknown on line 0
Warning:Unknown:Failed to write session data (files). Please verify this current setting of Session.save_path is correct (/var/lib/php/session) in Unknown on line 0
The approximate meaning of the above hints is that there is no permission to read the files in the Session directory. Presumably, the virtual host provider configuration server has made some modifications. In order to avoid trouble, this time directly in PHP set session file to save the directory bar.
Add the following code in the PHP code to precede the Session_Start ().
Ini_set (' Session.save_path ', DirName (__file__). /alixixi/');
Or:
Session_save_path (DirName (__file__). /alixixi/');
The previous session file generated by the Web site is saved to the Alixixi directory of the Web site's current root directory.
Note that not all configuration parameters can be set in the script, which is related to the scope of the parameter.
The following is a scope description of the configuration parameter referencing PHP
Php_ini_perdir: Instructions can be modified in php.ini, httpd.conf, or. htaccess files;
Php_ini_system: Instructions can be modified in php.ini and httpd.conf;
Php_ini_user: Instructions can be modified in user scripts;
Php_ini_all: Instructions can be changed anywhere;
Therefore, only the parameters of the Php_ini_user and Php_ini_all scopes can take effect in the settings in the script. The specific scope of the parameters can be retrieved from the network.
Articles that you may be interested in
- PHP uses the Session_set_save_handler () function to save session to MySQL database
- PHP sets the lifetime of the session
- PHP newspaper fatal error allowed memory size of ... How the out-of-memory error should be resolved
- PHP calculates a function of how many days (day) difference two dates
- The difference between a PHP session and a cookie
- PHP to read Chinese directory garbled solution
- PHP gets the timestamp of the start and end times of the week that the specified date is in
- PHP empty (delete) files in the specified directory, do not delete the Directory folder method