Home >Backend Development >PHP Tutorial >A problem occurs when thinkPHP connects to the server

A problem occurs when thinkPHP connects to the server

WBOY
WBOYOriginal
2016-07-30 13:31:051224browse

There was a problem when uploading the code to the server today. I wrote it down to prevent the same problem in the future.

1.session is lost across pages.

In 2 aspects, there is a parameter session.usr_tran_sid on php.ini changed to 1

Take another look to see if the path of session.save_path in phpinfo is writable. It may be because the file is not writable and the session cannot be saved.

2. $_get cannot get the value inside the framework

Later, the test found that admin/ The form xxx.html?id=1 cannot be retrieved, but admin.php/xxx.html?id=1 can be obtained. The initial judgment is that there is a problem with nginx's rewrite.

The rewritten code is as follows,


#                                                                                                                                                                                                                     to                                                                                            use   use       use using ’ ’s ’ through   use using   out out out out out out out out out out out out out out out out out out out out out out out off off to to s - , - , and .                                      +.php) (/.+) $ ") {
Set $ ​​fastcgi_script_name2 $ 1;
Set $ ​​PATH_INFO $ 2;
Fastcgi_param Path_info $ PATH_INFO;
ILENAME $ document_root $ fastcgi_script_name2;
FastCGI_PARAM Script_name $ FastCGI_Script_name2;
} location ~*.*.(gif|jpg|png|bmp|swf|js|css)(.*) index .php; t # try_files $ uri /index.php $uri ;
if (! -e $ request_filename) {

REWRITE ^ /Index.php (.*) $ /index.php?s= $1 last; ^/admin/(.*)$ /admin.php/$1?s=$1 last;
                                  rewrite ^(.*)$ /index.php?s=$1 last;
                                                                                              

The focus is on these three lines

References

http://blog.jjonline.cn/linux/159.html


http://www.sundabao.com/nginx%E4%B8%8B%E6 %94%AF%E6%8C%81thinkphp%E7%9A%84pathinfo%E5%92%8Curl-rewrite%E6%A8%A1%E5%BC%8F/


Copyright Statement: This article is an original article by the blogger , may not be reproduced without the permission of the blogger.

The above introduces some problems that arise when thinkPHP is connected to the server, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn