Php5.3.28 change cache acceleration eAccelerator to APC

Source: Internet
Author: User
Tags apc
APC and eAccelerator are both good PHP cache acceleration. Because eAccelerator has problems, you cannot select apc. We recommend that you select apc unless the eAccelerator has abnormal problems that cannot be solved, after all, apc also stops maintenance. php5.3 may not have a better choice. It has all evolved to 5.45.45.6, and zend-opcache is used in later versions.

APC and eAccelerator are both good PHP cache acceleration. Because eAccelerator has problems, you cannot select apc. We recommend that you select apc unless the eAccelerator has abnormal problems that cannot be solved, after all, apc also stops maintenance. php 5.3 may not have a better choice. It has all evolved towards 5.4 5.4 5.6. The higher version uses zend-opcache.

APC and eAccelerator are both good PHP cache acceleration. Because eAccelerator has problems, you cannot select apc. We recommend that you select apc unless the eAccelerator has abnormal problems that cannot be solved, after all, apc also stops maintenance. php5.3 may not have a better choice. It has all evolved to 5.4 5.4 and later versions use zend-opcache.

Recently, I have a new server php5.3.28 nginx1.62. Do I still use eAccelerator as usual? However, the php-frm deadlock may occur occasionally. No matter how you adjust the server or php configuration, it cannot be solved. In the case of a deadlock, the cli mode can still run php as usual, that is, a php-frm with a CPU of 99% will appear no matter any php page is running, and finally runs to 502 or 504.

When the strace-p is used to track the thread, sched_yield () = 0 appears continuously until the end of the loop. No other prompts are displayed.

After searching for the Internet for half a day, it should be an eAccelerator. A while is always executed cyclically in the internal system. As for why, the skill is limited. It seems that you can only change the cache acceleration plug-in, and finally decide the APC of the original php configuration.

Let's get started.

1. Download wget http://pecl.php.net/get/APC-3.1.9.tgz

2. decompress and compile
Tar zxvf APC-3.1.9.tgz
Cd APC-3.1.9
/Usr/local/php/bin/phpize
. /Configure-enable-apc-enable-mmap-enable-apc-spinlocks-disable-apc-pthreadmutex-with-php-config =/usr/local/php/bin/php- config
Make
Make install
Make clean

3. Edit php. ini

Find extension_dir, change the value to/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
Then add
[APC]
Extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/apc. so"
Apc. cache_by_default = On
Apc. enabled = On
Apc. max_file_size = 1 m
Apc. shm_segments = 1
Apc. shm_size = 64
Apc. stat = On
Apc. write_lock = On
Apc. mmap_file_mask =/tmp/apc. XXXXXX
Apc. ttl = 7200
Apc. user_ttl = 7200
Apc. gc_ttl = 3600
Apc. num_filters_hint = 1024
Apc. file_update_protection = 2

Specific configuration parameters to see: http://php.net/manual/zh/apc.configuration.php

If apc. stat is set to 0, the performance will be better. However, if it is set to 0, you must restart PHP after modifying the PHP file to update the content immediately. It is better to set the number to 1 for websites with many changes at ordinary times.

Restart php.

The eAccelerator deletes the cache directory and configures the php. ini file to be commented out.

If the following error occurs during installation of apc Extension

#/Usr/local/php/bin/phpize
Processing ing:
PHP Api Version :???????? 20090626
Zend Module Api No :????? 20090626
Zend Extension Api No :?? 220090626
Config. m4: 180: warning: AC_CACHE_VAL (PHP_APC_GCC_ATOMICS ,...) : Suspicious cache-id, must contain _ cv _ to be cached
.../../Lib/autoconf/general. m4: 1974: AC_CACHE_VAL is expanded from...
.../../Lib/autoconf/general. m4: 1994: AC_CACHE_CHECK is expanded from...
Config. m4: 180: the top level
Config. m4: 180: warning: AC_CACHE_VAL (PHP_APC_GCC_ATOMICS ,...) : Suspicious cache-id, must contain _ cv _ to be cached
.../../Lib/autoconf/general. m4: 1974: AC_CACHE_VAL is expanded from...
.../../Lib/autoconf/general. m4: 1994: AC_CACHE_CHECK is expanded from...
Config. m4: 180: the top level

Just press this autoconf-2.13
Http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz wget-c
Tar zxvf autoconf-2.13.tar.gz
Cd autoconf-2.13/
../Configure-prefix =/usr/local/autoconf-2.13
Make & make install

Export PHP_AUTOCONF =/usr/local/autoconf-2.13/bin/autoconf
Export PHP_AUTOHEADER =/usr/local/autoconf-2.13/bin/autoheader

Leave a message if you have any questions! Pai_^

Original article address: Change the cache acceleration eAccelerator to APC in php5.3.28. Thank you for sharing it with 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.