The session caused by phpAPC cannot save bugs and solutions

Source: Internet
Author: User
The session caused by phpAPC cannot save bugs and the solution APC accelerates php scripts significantly. Basically, it can increase the load capacity of the php-fpm server to two times, so in the production environment, we need to use APC to accelerate php scripts as much as possible .? Is this through web? Session caused by B php APC cannot save bugs and solutions

The acceleration effect of APC on php scripts is obvious. Basically, the load capacity of the php-fpm server can be increased to 2 times. Therefore, in the production environment, you need to use APC to accelerate php scripts as much as possible.

?

Is this through web? The pipeline stress test concluded that, in the production environment, after APC is used, the script execution speed is indeed improved (may reach 10-20%)

?

In the production environment, use session_set_save_handler to save the session to the MySQL memory table, and install the APC extension to find that the session cannot be saved. after repeated troubleshooting, the reasons for this problem are as follows:

?

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. of course, 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:

At the end of the php program execution, manually call session_write_close ();

?

You can also call the function defined by register_shutdown_function.

?

However, this problem does not exist if the default file storage session mechanism of php is used.

?

?

?

?

Related Article

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.