Tối Ưu XAMPP trên Windows - Improve XAMPP Performance

Tối Ưu XAMPP trên Windows - Improve XAMPP Performance

Improve-XAMPP-Performance-by-XenVn.webp

XAMPP là chương trình tạo web server được ứng dụng trên các hệ điều hành Linux, MacOS, Windows. XAMPP hoàn toàn miễn phí, dễ cài đặt và có chứa MariaDB, PHP và Perl.
Tải về miễn phí tại:
apachefriends.org/download.html

XAMPP is a program to create web servers that can be used on Linux, MacOS, and Windows operating systems. XAMPP is completely free, easy to install, and includes MariaDB, PHP, and Perl.
Free download at:
apachefriends.org/download.html

Các bước cài đặt cũng khá đơn giản, bạn hoàn toàn có thể tự làm chủ được.
Mặt định, XAMPP được cấu hình để chạy với hiệu năng khá kém, làm ảnh hưởng đến việc thực thi mã nguồn php của chúng ta.
Do đó, tôi sẽ hướng dẫn các bạn cấu hình lại 1 vài thông số để giúp XAMPP chạy nhanh hơn.


The installation steps are also quite simple, you can completely master it yourself.
By default, XAMPP is configured to run with pretty poor performance, affecting the execution of our php source code.
Therefore, I will guide you to reconfigure a few parameters to help XAMPP run faster.

Trước khi thực hiện hãy tắt tất cả các module của XAMPP.
Mở XAMPP Control Panel -> Chọn Stop tất cả các Module

Before doing so, disable all XAMPP modules.
Open XAMPP Control Panel -> Select Stop all Modules


Improve XAMPP Performance.webp



Ví dụ ở đây XAMPP được cài vào thư mục: C:\xampp
For example, here XAMPP is installed in the directory: C:\xampp

Phần 1: Cấu hình php.ini - Configure php.ini
Mở XAMPP Control Panel -> Tại mục Apache -> Chọn Config -> Chọn PHP (php.ini) -> Tập tin php.ini sẽ được mở ra.
Thêm các dòng sau vào cuối cùng, lưu ý cuối cùng phải có 1 dòng trống:
Open XAMPP Control Panel -> At Apache -> Select Config -> Select PHP (php.ini) -> The php.ini file will be opened.
Add the following lines at the end, keeping in mind that there must be an empty line at the end

Code:
# Extra #
[PHP]
zlib.output_compression = On
extension=gd
zend_extension=opcache
[opcache]
opcache.jit=0
opcache.enable=1

Phần 2: Cấu hình httpd.conf - Configure httpd.conf
Truy cập vào: apachelounge.com/download/
Tìm và tải về phiên bản mod_fcgid mới nhất (lưu ý lựa chọn 32 hay 64 bit, thông thường đều là 64 bit).
Giải nén file vừa tải về, tìm copy duy nhất file mod_fcgid.so và đem vào thư mục C:\xampp\apache\modules

Mở XAMPP Control Panel -> Tại mục Apache -> Chọn Config -> Chọn Apache (httpd.conf) -> Tập tin httpd.conf sẽ được mở ra.
Thêm các dòng sau vào cuối cùng, lưu ý cuối cùng phải có 1 dòng trống:

Go to: apachelounge.com/download/
Find and download the latest mod_fcgid version (note the choice of 32 or 64 bit, usually 64 bit).
Extract the downloaded file, find the only copy of the mod_fcgid.so file and put it in the folder C:\xampp\apache\modules
Open XAMPP Control Panel -> At Apache -> Select Config -> Select Apache (httpd.conf) -> The httpd.conf file will be opened.

Add the following lines at the end, keeping in mind that there must be a blank line at the end:
Code:
# CGI/FastCGI #
LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PATH "C:/xampp/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 50
FcgidMaxRequestLen 8131072
FcgidInitialEnv PHPRC "C:/xampp/php"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
<Files ~ "\.php$>"
    AddHandler fcgid-script .php
    FcgidWrapper "C:/xampp/php/php-cgi.exe" .php
</Files>
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php-cgi
</FilesMatch>
<IfModule actions_module>
    Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
</IfModule>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
    Options ExecCGI
    AllowOverride AuthConfig
    Require local
</Directory>
# Server Config #
LoadModule deflate_module modules/mod_deflate.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule filter_module modules/mod_filter.so
LogLevel error
HostnameLookups Off
SetOutputFilter DEFLATE
ExpiresActive On
ExpiresDefault "access plus 1 year"
Lưu ý thay thế C:/xampp/ thành đường dẫn đến thư mục cài đặt XAMPP trên máy tính của bạn.

Phần 3: Cấu hình my.ini - Configure my.ini
Mở XAMPP Control Panel -> Tại mục MySQL-> Chọn Config -> Chọn my.ini -> Tập tin my.ini sẽ được mở ra.
Thêm các dòng sau vào cuối cùng, lưu ý cuối cùng phải có 1 dòng trống:
Open XAMPP Control Panel -> At MySQL-> Select Config -> Select my.ini -> My.ini file will be opened.
Add the following lines at the end, keeping in mind that there must be a blank line at the end:

Code:
# Extra #
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4
skip-name-resolve
default_storage_engine = InnoDB
innodb_buffer_pool_size = 128M
innodb_log_file_size = 32M

Xong, bây giờ lưu mọi thứ lại và khởi động lại các dịch vụ của XAMPP sau đó xem tốc độ đã được cải thiện chưa nhé.
Done, now save everything and restart XAMPP services then see if the speed has improved.

xampp logo.webp
 
Last edited:
Top