Home WebServer PanelDirectAdmin How to disable OPCache on DirectAdmin

How to disable OPCache on DirectAdmin

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

In this article, AZDIGI will show you how to disable OPCache on DirectAdmin. Although OPCache brings a lot of benefits, what if you may be asked by your boss or dev team to disable it? This article will be the solution for you.

I. What is OPcache?

Originally called Zend Optimizer +, OPcache (introduced in PHP 5.5.0) is a powerful PHP extension built to enhance PHP performance, thus increasing overall application performance. It is available as an extension through PECL for PHP versions 5.2, 5.3 and 5.4. It works by storing precompiled script bytecode in shared memory or RAM, thus eliminating the need for PHP to load and parse the script on each request.

Benefits OPcache brings:

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

If you want to integrate Opcache PHP Extension into DirectAdmin, you can refer to the following tutorial:

II. How to disable OPCache on DirectAdmin

To disable OPCache on DirectAdmin, you can follow these 3 steps.

Step 1: SSH into your DirectAdmin system

To disable OPCache on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you do not know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSH, we go to Step 2 to check the OPCache version in use.

Step 2: Check the current OPCache version in use

To check the current OPCache version in use, we use the following command:

AZDIGI Tutorial
php -v
    

Here is my result.

How to disable OPCache on DirectAdmin
My OPCache version corresponds to the PHP version that uses 7.3.23.

We continue with Step 3 to execute commands to disable OPCache on DirectAdmin.

Step 3: Commands to disable OPCache on DirectAdmin

After checking the OPCache version in step 2, we execute the following commands to disable OPCache on DirectAdmin:

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build update
./build set opcache no
./build php y
    

Explanation of the above commands:

  • Command 1: Move to custombuild folder.
  • Command 2: Update custombuild script.
  • Command 3: Adjust OPCache usage status from yes to no.
  • Command 4: Reinstall your PHP versions with the new configuration. Option y is always accepted if additional compilation packages are needed.
How to disable OPCache on DirectAdmin
My screen after running commands 1 and 2
How to disable OPCache on DirectAdmin
My screen after running commands 3 and 4

In this step, when using php -v command, you will still see OPCache still exist. To disable OPCache, use the following command:

AZDIGI Tutorial
vi /usr/local/phpXX/lib/php.conf.d/10-directadmin.ini
    

You replace XX with the PHP version that you need to disable OPCache. For example, I only use PHP 7.3 version, I will use the command vi /usr/local/php73/lib/php.conf.d/10-directadmin.ini to do it.

Here you just need to edit and add # in front of the line containing the configuration where opcache.so exists. Here are my illustrations for you to easily visualize.

How to disable OPCache on DirectAdmin

You can then check again with the php -v command and you will no longer see OPCache showing up.

How to disable OPCache on DirectAdmin

So we have succeeded in disabling OPCache on DirectAdmin.

III. Summary

So AZDIGI has shown you how to disable OPCache on DirectAdmin. If you have multiple versions of PHP, then do the same to edit the configuration in step 3 . If you want the best performance for your system, don’t disable OPCache.

Hope this article will be of help to you.

Wishing you success!

See more useful articles about DirectAdmin at the following link:

If you need assistance, you can contact support in the ways below:

Đá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