[Info] Cài đặt phpMyAdmin với Apache trên CentOS 7

phpMyAdmin là một công cụ miễn phí được viết bằng PHP để quản trị MySQL thông qua trình duyệt web. Bài viết này sẽ giúp bạn cài đặt phpMyAdmin với Apache.

Cài đặt phpMyAdmin với Apache – phpMyAdmin là một công cụ mã nguồn mở miễn phí được viết bằng PHP để quản trị MySQL thông qua trình duyệt web. Nó có thể thực hiện nhiều tác vụ như tạo, sửa đổi hoặc xóa cơ sở dữ liệu, bảng, trường hoặc bản ghi; thực thi các câu lệnh SQL; hoặc quản lý người dùng và cấp quyền truy cập vào cơ sở dữ liệu.

Trong bài viết này, HOSTVN Tôi sẽ hướng dẫn bạn Cài đặt phpMyAdmin với Apache trên CentOS 7.

Cài đặt phpMyAdmin với Apache trên CentOS 7

1. Yêu cầu

VPS sử dụng hệ điều hành CentOS và đã cài đặt Apache, PHP và MariaDB

2. Cài đặt phpMyAdmin trên CentOS

Để cài đặt PhpMyAdmin, bạn chỉ cần chạy lần lượt các lệnh sau

cd /usr/share
wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip
unzip phpMyAdmin-5.0.2-all-languages.zip
mv phpMyAdmin-5.0.2-all-languages phpMyAdmin
rm -rf phpMyAdmin-5.0.2-all-languages.zip
rm -rf /usr/share/phpMyAdmin/setup

Bạn có thể truy cập phpmyadmin.net để lấy link tải phpMyAdmin phiên bản mới nhất.

3. Định cấu hình phpMyAdmin

Tệp cấu hình của PhpMyadmin là tệp config.inc.php. Trước tiên, bạn cần chạy lệnh sau

mv /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

Tiếp theo, mở tệp /usr/share/phpMyAdmin/config.inc.php

nano /usr/share/phpMyAdmin/config.inc.php

– Tìm thấy

$cfg['blowfish_secret'] = '';

Thêm bất kỳ ký tự nào giữa các dấu ngoặc kép. Ví dụ:

$cfg['blowfish_secret'] = 'dsa123e12rwDSADs1few12tr3ewg3s2df3sAD';

– Tiếp theo, thêm đoạn mã sau vào cuối tệp

$cfg['TempDir'] = '/usr/share/phpMyAdmin/tmp/';

Nhấn Điều khiển + o và hãy nhấn đi vào để lưu tệp, nhấn Điều khiển +x để thoát khỏi nano. Sau đó, bạn cần tạo thư mục tmp cho PhpMyAdmin

mkdir -p /usr/share/phpMyAdmin/tmp
chown -R nginx:nginx /usr/share/phpMyAdmin/tmp

4. Định cấu hình vhost cho PhpMyAdmin

Để có thể truy cập PhpMyAdmin, bạn cần phải có vhost cho nó. Tạo tệp /etc/httpd/conf.d/phpmyadmin.conf với nội dung sau

Alias /pma /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
 
<Directory /usr/share/phpMyAdmin/>
    AddDefaultCharset UTF-8
    <IfModule mod_authz_core.c>
    # Apache 2.4
    <RequireAny>
        <RequireAll>
            Require all granted
        </RequireAll>
    </RequireAny>
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order Deny,Allow
        Deny from All
        Allow from All
        Allow from ::1
    </IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/log/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/templates/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/tmp/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

Khởi động lại apache để tải cấu hình

systemctl restart httpd

5. Truy cập phpMyAdmin

Để truy cập giao diện phpMyAdmin, hãy mở trình duyệt của bạn và truy cập http: // ip-vps / phpmyadmin:

Screenshot_54 - Cài đặt phpMyAdmin với Nginx

6. Kết luận

Qua bài đăng này HOSTVN Mình sẽ hướng dẫn các bạn cài đặt phpMyAdmin bằng Apache trên CentOS 7. Nếu có góp ý các bạn có thể để lại bình luận bên dưới.

Viết một bình luận

bahis10bets.com betvole1.com casinomaxi-giris.com interbahis-giris1.com klasbahis1.com mobilbahisguncelgiris1.com piabetgiris1.com tipobettgiris.com tumbetgiris1.com betboro 1xbet giriş
bahis10bets.com betvole1.com casinomaxi-giris.com interbahis-giris1.com klasbahis1.com mobilbahisguncelgiris1.com piabetgiris1.com tipobettgiris.com tumbetgiris1.com betboro 1xbet giriş
antalya bayan escort
antalya bayan escort
antalya bayan escort