Home >Operation and Maintenance >Linux Operation and Maintenance >How to install PHP memcache extension under Linux
Step 1: Install dependencies
Before installing the memcache extension, we need to install some system dependencies. Open a terminal and enter the following command:
sudo apt-get update sudo apt-get install build-essential libtool autoconf automake
This will install the compiler and required build tools.
Step 2: Download and install memcached
Before installing the memcache extension, we need to install memcached first. Memcached is a distributed memory object caching system that stores data in memory for fast access. Use the following command to download and install memcached:
sudo apt-get install memcached
Step 3: Download the memcache extension
Before installing the memcache extension for PHP, we need to download the source code. You can download the latest version from the following website:
http://pecl.php.net/package/memcache
Use the following commands to download and decompress the source code:
wget http://pecl.php.net/get/memcache-x.x.x.tgz tar -xvzf memcache-x.x.x.tgz
Step 4: Compile and install the memcache extension
After installing the required packages, we can compile and install the memcache extension. Switch to the memcache source code directory and execute the following command:
cd memcache-x.x.x phpize ./configure make sudo make install
Step 5: Configure PHP.ini
After installing the memcache extension, we need to configure it in the PHP configuration file Add it. Open your PHP configuration file (usually /etc/php.ini) and add the following line:
extension=memcache.so
After saving and closing the file, restart the web server so the new settings can take effect.
The above is the detailed content of How to install PHP memcache extension under Linux. For more information, please follow other related articles on the PHP Chinese website!