In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "the solution to the problem of installing memcache extension in PHP under CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The system version is 5.2. record the method of installing memcached first:
The code is as follows:
Cd ~ / memcached
Wget-c http://www.monkey.org/~provos/libevent-1.4.10-stable.tar.gz
Wget-c http://memcached.googlecode.com/files/memcached-1.2.8.tar.gz
# install libevent
Tar-zxvf libevent-1.4.10-stable.tar.gz
Cd libevent-1.4.10-stable
. / configure
Make
Make install
# install memcached
Cd..
Tar-zxvf memcached-1.2.8.tar.gz
Cd memcached-1.2.8
. / configure
Make
Make install
# if it is a 64-bit system, you also need to copy the libevent file to / wp-content/lib64/ to solve the error while loading shared libraries problem
Cp-R / wp-content/local/lib/libevent* / wp-content/lib64/
All right, start installing the extension of php. The nightmare began. I thought it would be OK to install php-devel.x86_64 and php-pecl-memcache.x86_64 directly with yum, but after installing it, I couldn't find the memcache extension in phpinfo (). I still couldn't do it again. Goooooooooooooogle, I found an article called "PHP Pecl Memcached module installation problems". It was saved by remove php-pecl-memcache.x86_64 and then executed it.
Pecl install memcache
Smooth installation, open / etc/php.d/ to take a look, there is no memcache.ini, all right, manually to / etc/php.ini plus extension=memcache.so, all right, restart httpd, refresh phpinfo (), unexpectedly not yet, I am depressed.
Looking back, I seem to have missed a place not checked, immediately open / wp-content/lib64/php/modules/ to check, sure enough, there is no memcache.so, where will it be? Find-name, originally hidden under / wp-content/local/lib/php/extensions/no-debug-non-zts-20060613/, copied to / wp-content/lib64/php/modules/ and tried again, the long-lost memcache extension appeared. T T
Memcached parameter description:
The-d option is to start a daemon
-m the amount of memory allocated to Memcache, in MB
-u users running Memcache
-l IP address of the server that is listening
-p set the port on which Memcache listens, preferably above 1024
-c the maximum number of concurrent connections running. The default is 1024, which is set according to the load of your server.
-P set the pid file to save Memcache
Start:
Memcached-d-u root-m 128-c 8192
View status:
Watch "echo stats | nc 127.0.0.1 11211"
Status description:
Number of seconds that uptime:memcached runs
Cmd_get: the number of times the cache is queried. By dividing the two data, you can get the average number of requests for cache per second.
Cmd_set: set the number of times key= > value
Get_hits: the number of cache hits. Cache hit ratio = get_hits/cmd_get * 100%
Scurr_items: the number of key-value pairs now in the cache
Related website:
Libevent: http://www.monkey.org/~provos/libevent/
Memcached: http://danga.com/memcached/
PHP Memcached Extension: http://pecl.php.net/package/memcache
Undefined
[shell]
[root@~] # pecl install memcache
Downloading memcache-2.2.6.tgz...
Starting to download memcache-2.2.6.tgz (35957 bytes)
.done: 35957 bytes
11 source files, building
WARNING: php_bin / opt/php/bin/php appears to have a suffix / bin/php, but config variable php_suffix does not match
Running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Enable memcache session handler support? [yes]: n
[/ shell]
[shell]
Running: make INSTALL_ROOT= "/ var/tmp/pear-build-root/install-memcache-2.2.6" install
Installing shared extensions: / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/
Running: find "/ var/tmp/pear-build-root/install-memcache-2.2.6" | xargs ls-dils
11370548 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6
11370602 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt
11370603 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php
11370604 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib
11370605 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php
11370606 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions
11370607 4 drwxr-xr-x 2 root root 4096 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626
11370601 236-rwxr-xr-x 1 root root 235639 Jan 6 15:55 / var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so
Build process completed successfully
Installing'/ opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so'
Install ok: channel://pecl.php.net/memcache-2.2.6
Configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini
[/ shell]
This is the end of the content of "the solution to the problem of installing memcache extensions on PHP under CentOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.