Php session startup failure solution original address: www.hjaa.net? The error message returned when p1149php fails to start the session. in php. ini, the session settings are incorrect, causing the session? Cookies cannot be sent or kept. Troubleshooting steps: 1. Save the following text as phpinfo. php and upload it to the server for access. solution to the session startup failure of php
Original address: http://www.hjaa.net /? P = 1149
The cause of the php session startup failure is: in php. ini, the session settings are incorrect, causing the session? Cookies cannot be sent or kept.
Troubleshooting steps:
1. Save the following text as phpinfo. php, and upload to the server to access, such as the site http://www.hjaa.net/phpinfo.php
Phpinfo ();
?>
Focus on session
2. session. cookie_domain sets the domain name, that is, session. cookie_domain? =? Why does A domain name result in A session? Cookies are invalid on the B domain name.
Solution 1: Set session. cookie_domain in php. ini to Null, that is, session. cookie_domain? =
Solution 2: session. cookie_domain? = Set to your domain name
3. in php. ini, session. cookie_path is too strict. For example, set session. cookie_path? =? /Hjaa/that is to say, only the hjaa directory and sub-directory under the root domain name can be used to use session (more specifically, if session. if cookie_domain is set with the domain name, the session is allowed only for the hjaa directory and subdirectory under the domain name)
Solution: Set session. cookie_path in php. ini to "/" (without double quotation marks) or a more relaxed security setting, for example :? Session. cookie_path? =? /
4. in php. ini, mix session. cookie_path and session. save_path to indicate the path of temporary session file storage. In fact, session. cookie_path indicates the website domain in which the session takes effect and has nothing to do with the file permission on the server. session. save_path indicates the path for setting the temporary session file storage. For example, set session. cookie_path to session. cookie_path? =? C:/WINDOWS/TEMP.
5. the directory set by session. save_path does not have the write permission; or the setting is incorrect (for example, the set folder does not exist ). Note: If it is null, the default system temporary folder path is used. Windows is generally "% SystemRoot % \ TEMP", unix is generally "/tmp"
Solution:
(1) If session. save_path is not left blank, make sure that the setting value corresponds to a folder and the folder exists. If you do not know how to set it, comment out this setting or change it to a null value so that php can use the default setting.
(2) grant the write permission to the corresponding user in the corresponding directory. for example, for IIS, grant the write permission to the Internet guest account.
6. when the session. when auto_start = on, executing session_start () will generate a new session_idsession.auto_start = on. The advantage is that you will not forget to execute session_start () or session_start () at any time () the location in the program is incorrect, leading to errors. if you are using third-party code, you must delete all session_start (). Otherwise, the correct result cannot be obtained.
Solution:
(1) session. auto_start = Off
(2) remove session_start (); from the program.