🆙 Added full speed opcache 🆙

This commit is contained in:
Remco
2025-09-21 13:25:55 +02:00
parent e29ca8c067
commit 1f8eab29b2
+31 -4
View File
@@ -1,10 +1,14 @@
Hier is de handleiding aangevuld met de stappen voor het instellen van de `opcache.file_cache` directive, wat een extra prestatieverbetering biedt.
-----
Here is a step-by-step tutorial in English on how to enable OPcache.
-----
### Step 1: Install the OPcache PHP Extension
First, you need to install the OPcache module for your specific PHP version. The package name is typically `php-opcache`, but it's a virtual package. You must specify the exact version.
First, you need to install the OPcache module for your specific PHP version. The package name is typically `php-opcache`, but you must specify the exact version.
1. **Check your PHP version:**
`php -v`
@@ -48,7 +52,30 @@ Now, you need to enable and configure OPcache in your PHP configuration file. Th
-----
### Step 3: Restart Your Web Server
### Step 3: Enable the File Cache 💾
This is an optional but highly recommended step for an additional performance boost. It creates a persistent cache on your hard drive, which is useful when the server restarts.
1. **Add the following line to the `[opcache]` section** in your `php.ini` file:
```ini
opcache.file_cache="/var/www/opcache"
```
This directive sets the path where OPcache will store a copy of the precompiled bytecode.
2. **Create the cache directory** and make sure your web server has write permissions.
```bash
sudo mkdir /var/www/opcache
sudo chown -R www-data:www-data /var/www/opcache
```
(Note: The user `www-data` is common on Debian/Ubuntu. If you're on a different system, replace `www-data` with your web server's user, e.g., `apache` or `nginx`).
-----
### Step 4: Restart Your Web Server 🔄
After saving the `php.ini` file, you must restart your web server for the changes to take effect. The command depends on your setup.
@@ -60,7 +87,7 @@ After saving the `php.ini` file, you must restart your web server for the change
-----
### Step 4: Verify that OPcache is Active
### Step 5: Verify that OPcache is Active
To confirm that OPcache is working, create a PHP info file in your web root.
@@ -76,4 +103,4 @@ To confirm that OPcache is working, create a PHP info file in your web root.
Navigate to `http://your_domain.com/info.php`.
3. **Check the OPcache section:**
Search for **"Zend OPcache"**. The "Opcode Caching" status should be **"Up and Running"**. You will also see the configuration settings you just applied.
Search for **"Zend OPcache"**. The "Opcode Caching" status should be **"Up and Running"**. You will also see the configuration settings you just applied, including the path to the file cache.