Session caused by php apc cannot save bugs and Solutions

Source: Internet
Author: User
Tags apc

Introduction: This is a detailed page of php apc-caused session failure to save bugs and solutions. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 335086 'rolling = 'no'>

APC Pairs
PHP
The acceleration effect of the script is obvious.
Php-FPM
The server load capability has been improved
2
Times, so in the production environment, use as much as possible
APC
To accelerate
PHP
Script.

This is my web tracking
Stress testing results, and in the production environment, use
APC
The script execution speed is indeed improved.

(May reach 10-20%
)

Use in production environment
Session_set_save_handler
Set
Save session
MySQL
Memory table, and installed
APC
Extension, and you will find that it cannot be saved
Session
After repeated troubleshooting, it is because
APC
Cause analysis:

The general environment session is statically compiled into PHP, so the session module must be loaded before the APC that is dynamically compiled into PHP. That is to say, during the request closure period, the APC request closes the function, the function will be called before the session request.

Therefore, when the Session Request closes the function call, the class table in the execution environment is empty, and a fatalError cannot be found for the class will be thrown.

-- In essence, the database instance has been destroyed, causing an error that cannot be seen.

The solution is very simple:

In PHP
ProgramExecuted, manually called
Session_write_close ();

Or in register_shutdown_function
It can also be called in the defined function.

However, if you use PHP
Default file storage
Session
This problem does not exist.

More articles about "session caused by php apc cannot save bugs and Solutions"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/335086.html pageno: 10.

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.