Home WebServer PanelDirectAdmin Install OPcache Directadmin to speed up the website with custombuild 2.0

Install OPcache Directadmin to speed up the website with custombuild 2.0

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

To install OPcache DirectAdmin we first need to understand what OPcache is.

OPcache will save the content “precompile php code to the shared memory”. Thus, it helps to reduce the reading of PHP source code from the hard drive and recompile it every time a website is accessed.

Benefits OPcache brings:

  • Helps reduce %CPU for the server.
  • Reduce TTFB of all sites on the server.
  • Increase website loading speed.

Note:

  • Only install the OPcache module for PHP through CustomBuild 2.0, if you are still using Custombuild 1.x you should upgrade to CustomBuild 2.0 before doing OPcache installation.
  • OPcache does not work with suphp.

To check the CustomBuild version, please see the article: Check the version of CustomBuild in use (check custombuild version)

To upgrade CustomBuild 1.x to 2.0, please see the article: Upgrading CustomBuild version from 1.x to 2.0

Step 1. Install OPCache DirectAdmin with CustomBuild 2.0 (install OPcache DirectAdmin with CustomBuild 2.0)

To install OPCache DirectAdmin you just need to manipulate a few commands below to be successful. But only with CustomBuild 2.0.

Move to DirectAdmin’s build directory and change OPcache value to Yes

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build set opcache yes

You will receive the following information:

AZDIGI Tutorial
Changed opcache option from no to yes

Continue compiling OPcache module with CustomBuild 2.0

AZDIGI Tutorial
./build opcache

Depending on the PHP version you are using on the server, the following log will be different. Here my server uses 3 versions of PHP 5.6/7.2/7.3.

AZDIGI Tutorial
opCache 7.0.6 is now installed for PHP 5.6
opCache 7.0.6 is now installed for PHP 7.2
opCache 7.0.6 is now installed for PHP 7.3
opCache 7.0.6 PHP extension has been installed successfully.

In case your webserver is using Openlitespeed, you need to run the following command to get OPCache.

AZDIGI Tutorial
killall -9 lsphp

Step 2. Check OPcache module after installing OPcache successfully

We use the following command to check:

AZDIGI Tutorial
php -v

The results returned are as follows:

AZDIGI Tutorial
PHP 5.6.40 (cli) (built: Mar 27 2019 22:13:46)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
install OPcache DirectAdmin

Depending on the first PHP version your system returns, the results will be different.

If there is “Zend OPcache” it means success.

Or we can see it directly with the file phpinfo.php

In the user section, you change to the correct user of domaincuaban.com you want to see.

AZDIGI Tutorial
cd /home/user/domaincuaban.com/public_html/
vi phpinfo.php

Then insert the following php code into this file:

Save the file and access it with the corresponding domain: http://yourdomain/phpinfo.php

install OPcache DirectAdmin
Zend OPcache

You Ctrl + F to search with “Zend OPcache” as the picture above is successful.

Your website speed will improve gradually over time. In the immediate future, ttfb will be reduced immediately. I checked with my website, the TTFB has decreased from over 500ms to ~200ms. Because I use WordPress WooCommerce theme, it is quite heavy.

Wishing you success!

Reference article: Installing php OpCache with CustomBuild 2.0

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign