Apache web server<\/a>.<\/p>\n\n\n\nFirst, you will need to install Apache, PHP, and other PHP extensions on your server. You can install them with the following command:<\/p>\n\n\n\n
apt-get install apache2 libapache2-mod-php php php-cli php-opcache php-mysql php-zip php-gd php-mbstring php-curl php-xml -y<\/code><\/pre>\n\n\n\n
Once all the packages are installed, verify the PHP version with the following command:<\/p>\n\n\n\n
php -version<\/code><\/pre>\n\n\n\nYou should get the following output:<\/p>\n\n\n\n
PHP 8.1.2-1ubuntu2.13 (cli) (built: Jun 28 2023 14:01:49) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.2, Copyright (c) Zend Technologies\nwith Zend OPcache v8.1.2-1ubuntu2.13, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\n
Next, you will need to enable the PHP OPcache by editing php.ini file.<\/p>\n\n\n\n
nano \/etc\/php\/8.1\/apache2\/php.ini<\/code><\/pre>\n\n\n\n
Uncomment the following lines:<\/p>\n\n\n\n
opcache.enable=1\nopcache.memory_consumption=128\nopcache.max_accelerated_files=10000\nopcache.revalidate_freq=200<\/code><\/pre>\n\n\n\n
Save and close the file, then restart the Apache service to apply the changes:<\/p>\n\n\n\n
systemctl restart apache2<\/code><\/pre>\n\n\n\n
You can now verify the PHP OPcache installation with the following command:<\/p>\n\n\n\n
php -i | grep opcache<\/code><\/pre>\n\n\n\n
You should get the following output:<\/p>\n\n\n\n
\u2026\nopcache.file_cache_consistency_checks => On => On\nopcache.file_cache_only => Off => Off\nopcache.file_update_protection => 2 => 2\nopcache.force_restart_timeout => 180 => 180\nopcache.huge_code_pages => Off => Off\nopcache.interned_strings_buffer => 8 => 8\nopcache.jit => tracing => tracing\nopcache.jit_bisect_limit => 0 => 0\nopcache.jit_blacklist_root_trace => 16 => 16\nopcache.jit_blacklist_side_trace => 8 => 8\nopcache.jit_buffer_size => 0 => 0\nopcache.jit_debug => 0 => 0\nopcache.jit_hot_func => 127 => 127\nopcache.jit_hot_loop => 64 => 64\nopcache.jit_hot_return => 8 => 8\nopcache.jit_hot_side_exit => 8 => 8\nopcache.jit_max_exit_counters => 8192 => 8192\n\u2026<\/code><\/pre>\n\n\n\n