phpmyadmin课程之linux下phpmyadmin的安装

PHPz
Release: 2019-11-01 13:16:20
forward
1243 people have browsed it

安装
在phpmyadmin官网(https://www.phpmyadmin.net/downloads/)选择合适的版本及压缩格式并下载,这里我选择的是phpMyAdmin-4.6.0-all-languages.tar.gz
下载

haitiancoder@mylinux:~$ curl -L -O https://files.phpmyadmin.net/phpMyAdmin/4.6.0/phpMyAdmin-4.6.0-all-languages.tar.gz
Copy after login

解压

haitiancoder@mylinux:~$ tar -xvf phpMyAdmin-4.6.0-all-languages.tar.gz
Copy after login

修改文件夹名、删除压缩包

haitiancoder@mylinux:~$ mv phpMyAdmin-4.6.0-all-languages phpmyadmin
haitiancoder@mylinux:~$ rm phpMyAdmin-4.6.0-all-languages.tar.gz
Copy after login

配置phpMyAdmin

haitiancoder@mylinux:~$ cd phpmyadmin/
haitiancoder@mylinux:~/phpmyadmin$ cp config.sample.inc.php config.inc.php
haitiancoder@mylinux:~/phpmyadmin$ vi config.inc.php
Copy after login

phpMyAdmin的配置中有一个参数需要blowfish_secret,可在这个网址获取,比如

4mn8gJ(Tmk0U7VNs~cq]}D9o=yp=uHN}}F27^#Xf4OK
Copy after login

修改参数并保存退出:

$cfg['blowfish_secret'] = '4mn8gJ(Tmk0U7VNs~cq]}D9o=yp=uHN}}F27^#Xf4OK';
Copy after login

配置nginx
我的nginx配置方法是在原 /etc/nginx/nginx.conf 配置文件中加入

include /etc/nginx/sites-enabled/*;
Copy after login

再分别创建sites-available和sites-enabled文件夹,每个项目单独配置。
下面是具体配置phpMyAdmin的过程:

haitiancoder@mylinux:~/phpmyadmin$ sudo vi /etc/nginx/sites-available/phpmyadmin
Copy after login

填入配置信息,我这里是以通过7000端口访问为例:

server {
        listen 7000;
        root /home/haitiancoder/phpmyadmin/;
        index index.php index.html index.htm;
        location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
Copy after login

注:因php版本不同fastcgi_pass项会有所不同
使配置生效

haitiancoder@mylinux:~/phpmyadmin$ sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/phpmyadmin 
haitiancoder@mylinux:~/phpmyadmin$ sudo service nginx reload
Copy after login

现在访问你的7000端口就可以访问phpMyAdmin了。

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template