PHP Tutorials

Installing PHP 7.0 APCu Extension

In order to include object caching functionality in PHP 7.0, The APCu extension is used.

Earlier APC extension was used, but it has been replaced by APCu nowadays. The previous version used to be known by the APC in PHP 5.5, it used to provide opcode and object caching functionality. However, as the time pass by developer created APCu which is more flexible and robust.

How to Install APCu on PHP 7.0, 7.1, 7.2 ?

In order to install APCu extension in PHP 7.0, 7.1, 7.2 +, you must log inside your server as a root user using SSH access. Hit below commands in your terminal.

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
# Replace X with your php version number
sudo pecl7.X-sp install apcu

It will ask the given below question, hit enter.

# Hit Enter in response to this question
Enable internal debugging in APCu [no] :

As soon as you entered the above command, it will start processing once it is finished with the process. Then create a file to keep the configuration for the extension, finally run the below command as a root user to restart the PHP.

# Replace php7.X-sp => X with your PHP version
sudo bash -c "echo > /etc/php7.X-sp/conf.d/apcu.ini"
# Replace php7.X-sp => X with your PHP version
sudo service php7.X-fpm-sp restart

APCu creates some problems if you are using PHP 7+ versions. To provide full backward compatibility with APCu with PHP 7+, we should install APCu Backwards Compatibility extension.

How to Verify PHP APCu Installation?

Use the below command to make sure whether the APCu PHP extension is installed precisely.

phpX.Y-sp -i | grep apcu

Following will be the output of above cmd:

# Replace php7.X-sp => X with your PHP version
Additional .ini files parsed => /etc/phpX.Y-sp/conf.d/apcu.ini,


How to Uninstall the PHP APCu Extension?

Type the below command in terminal, to uninstall the PHP APCu extension.

# Replace php7.X-sp => X with your PHP version

sudo rm /etc/phpX.Y-sp/conf.d/apcu.ini
sudo peclX.Y-sp uninstall apcu

Finally, don’t forget to restart the PHP-FPM:

sudo service phpX.Y-fpm-sp restart

I am Digamber, a full-stack developer and fitness aficionado. I created this site to bestow my coding experience with newbie programmers. I love to write on JavaScript, ECMAScript, React, Angular, Vue, Laravel.

Recent Posts

React Router DOM 6 Fetch Current URL / Pathname Tutorial

If you want to learn how to get the current route's name, component pathname or…

2 days ago

React Js Hide & Show with React Bootstrap Collapse Tutorial

React show and hide example. In this tutorial, we will show you how to step…

5 days ago

How to Integrate Tabs in React Js with React Bootstrap

Tabs are one of the best UI elements for displaying multiple contents in a single…

1 week ago

How to Build Toast Component in React Js with Bootstrap

In this tutorial, we will learn how to create a toast notification component in the…

2 weeks ago

React Js Bootstrap Modal Popup Component Tutorial

Bootstrap offers tons of custom UI solutions. On top of that, it is easy to…

2 weeks ago

React Build Counter using useReducer Hook Tutorial

React js counter using the useReducer hook example. In this post, we will learn how…

2 weeks ago