• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How To Install APC on PHP 7.2 (Ubuntu LAMP Server)

By Abhishek Ghosh August 31, 2018 11:35 am Updated on April 14, 2020

How To Install APC on PHP 7.2 (Ubuntu LAMP Server)

Advertisement

APC is an Important Part For WordPress Like Web Software to Speed Up. Here is How To Install, Configure APC on PHP 7.2 on Ubuntu LAMP Server. We have older guides on this website to setup APC for PHP 7.0. However, PHP 7.2 needs slight different commands (which may be difficult for an not so used to configure). Although Zend Op Cache is sufficient for many web software, APC Object Cache backend for WordPress on single-server sites perform a lot better.

Update : This guide is an update to this article for installing PHP 7.4

WordPress has a built-in object caching API which is used to store complex data objects (may be HTML structures as well). The Alternative PHP Cache (APC) and OPcache both provide opcode caching. However, Zend OPcache is like a quick fix whereas APC is the full version. After installation of APC, you may test disabling Opcache to chec difference and also both together.

Advertisement

---

 

Steps of How To Install APC on PHP 7.2

 

First SSH to your instance and update, upgrade :

Vim
1
2
apt update -y
apt upgrade -y

If you have installed PHP in our normal way, then just run this command to install APC :

Vim
1
pecl install apcu

You’ll receive huge output like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pecl install apcu
downloading apcu-5.1.12.tgz ...
Starting to download apcu-5.1.12.tgz (105,890 bytes)
........................done: 105,890 bytes
39 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
Enable internal debugging in APCu [no] : yes
building in /tmp/pear/temp/pear-build-rootoK2n7A/apcu-5.1.12
running: /tmp/pear/temp/apcu/configure --with-php-config=/usr/bin/php-config --enable-apcu-debug=yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
....

You’ll get an end like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Libraries have been installed in:
   /tmp/pear/temp/pear-build-rootoK2n7A/apcu-5.1.12/modules
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 
Build complete.
Don't forget to run 'make test'.
 
running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootoK2n7A/install-apcu-5.1.12" install
Installing shared extensions:     /tmp/pear/temp/pear-build-rootoK2n7A/install-apcu-5.1.12/usr/lib/php/20151012/
...
install ok: channel://pecl.php.net/apcu-5.1.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=apcu.so" to php.ini

To start using APCu, you should run the following command for PHP 7.2:

Vim
1
echo "extension=apcu.so" | tee -a /etc/php/7.2/mods-available/apcu.ini

And the following command for PHP 7.0:

Vim
1
echo "extension=apcu.so" | tee -a /etc/php/7.0/mods-available/apcu.ini

Reload apache :

Vim
1
systemctl restart apache2

If you run :

Vim
1
php -i | grep apcu

You’ll get confirmed path of the settings file for CLI, like :

Vim
1
/etc/php/7.2/cli/conf.d/20-apcu.ini

Modify to the following in mods_enabled file (like /etc/php/7.2/mods-available/apcu.ini) :

Vim
1
2
3
4
5
6
7
8
9
10
11
extension=apcu.so
apc.enabled=1
apc.shm_size=1024M
apc.max_file_size=10M
apc.num_files_hint=20000
apc.user_entries_hint=20000
apc.ttl=7200
apc.user_ttl=7200
apc.gc_ttl=3600
apc.include_once_override=0
apc.enable_cli=1

Save it. Open PHP.ini file which is under Apache’s path, like :

Vim
1
nano /etc/php/7.2/apache2/php.ini

Add a block above settings of cURL (usually opcache settings written above it) :

Vim
1
nano /etc/php/7.2/apache2/php.ini

Reload apache :

Vim
1
systemctl restart apache2

Tuning APC on production server not funny. APC’s one settings can make site not loading. You have to delete that settings file and restart Apache, then try finding which settings was faulty. You can slowly try this settings :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extension=apc.so
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 40M
apc.optimization = 0
apc.num_files_hint = 4096
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 0
apc.cache_by_default = 1
apc.filters = ""
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 10M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
;apc.rfc1867 = 0
;apc.rfc1867_prefix = "upload_"
;apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
;apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0

You can check APC settings in system with this command :

Vim
1
php -r 'phpinfo();' | grep -i 'apc'

It is what expected :

Vim
1
2
3
4
5
6
7
APCu Support => Enabled
APCu Debugging => Enabled
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
...
...

Getting that APCu Support => Enabled not easy.

Go to your public directory, like /var/www/html :

Vim
1
cd /var/www/html

wget this file there :

Vim
1
https://github.com/krakjoe/apcu/blob/master/apc.php

How To Install APC on PHP 7-2

Like :

Vim
1
2
cd /var/www/html
wget https://raw.githubusercontent.com/krakjoe/apcu/master/apc.php

Open that webpage on browser. That makes you sure that APC actually working.

Tagged With php7 2 apc , install APC PE6U21W , install apc cache ubuntu , How to install ubutu on apc , how to install apc , build apcu so , apcu ini , apc y php 7 2 , apc php 7 , ubuntu install apc

This Article Has Been Shared 485 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Install APC on PHP 7.2 (Ubuntu LAMP Server)

  • How to Install, Configure, Secure MongoDB on Ubuntu 16.04 LTS

    MongoDB is a Modern, Lightweight, Scalable NoSQL Database. Here is How to Install, Configure, Secure MongoDB on Ubuntu 16.04 From SSH.

  • Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS

    Here is Latest, Tested Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS For Cloud Server, VPS and Dedicated Server.

  • How To Install Webmin on Ubuntu 18.04 LTS Cloud Server

    Here is How To Install Jupyter Notebook on Ubuntu 18.04 LTS Server So That You Can Work From Anywhere or Share Live Notebooks.

  • How To Install SBT and Scala on Ubuntu Server

    Here Are The Steps on How To Install SBT and Scala on Ubuntu Server. sbt is a build tool for Scala and Java projects Like Apache Maven, Apache Ant.

  • Analysis of Jenkins for DevOps : Part I

    This is Part I of Series Analysis of Jenkins for DevOps. Jenkins is a software system developed for maintaining collaboration, quality management, agility.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023
  • What is Vehicular Ad-Hoc Network? January 24, 2023
  • Difference Between Panel Light, COB Light, Track Light January 21, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How To Install APC on PHP 7.2 (Ubuntu LAMP Server)," in The Customize Windows, August 31, 2018, January 29, 2023, https://thecustomizewindows.com/2018/08/how-to-install-apc-on-php-7-2-ubuntu-lamp-server/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT