ThinkPHP server problems

Source: Internet
Author: User
: This article mainly introduces thinkPHP server-to-server issues. if you are interested in the PHP Tutorial, please refer to it. There is a problem with code going to the server today. remember to avoid the same problem later.

1. cross-page session loss,

There is a session. usr_tran_sid parameter changed to 1 on php. ini.

Check whether the path of session. save_path in phpinfo can be written. it may be because the file cannot be written and the session cannot be stored,

2. $ _ get in the framework cannot get the value.

Later I tested and found admin/xxx.html? Id = 1 cannot be obtained, admin. php/xxx.html? Id = 1 can be obtained. it is preliminarily determined that there is a problem with nginx rewrite rewriting,

The rewrite code is as follows,


# Fastcgi_param PATH_INFO $ fastcgi_path_info;
# Fastcgi_param PATH_TRANSLATED $ document_root $ fastcgi_path_info;
Include fastcgi. conf;
# Set PATH_INFO and rewrite the SCRIPT_FILENAME and SCRIPT_NAME server environment variables
Set $ fastcgi_script_name2 $ fastcgi_script_name;
If ($ fastcgi_script_name ~ "^ (. + \. Php) (/. +) $ "){
Set $ fastcgi_script_name2 $1;
Set $ path_info $2;
}
Fastcgi_param PATH_INFO $ path_info;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name2;
Fastcgi_param SCRIPT_NAME $ fastcgi_script_name2;
}
Location ~ *. * \. (Gif | jpg | png | bmp | swf | js | css )(.*)
{
Expires 7d;
Break;
}
Location/
{
Index index.html index.htm index. php;
# Try_files $ uri/index. php $ uri;
If (! -E $ request_filename ){
Rewrite ^/index. php (. *) $/index. php? S = $1 last;
Rewrite ^/admin/(. *) $/admin. php/$1? S = $1 last;
Rewrite ^ (. *) $/index. php? S = $1 last;
Break;
}
}
}

Focus 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 Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above introduces thinkPHP's problems on the server, including some content. I hope my friends who are interested in PHP tutorials can help me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.