todaygood / linux-lab

everything kb,case about linux
1 stars 0 forks source link

在windows上安装mariadb+php+nginx+phpMyAdmin #16

Open todaygood opened 5 years ago

todaygood commented 5 years ago

Step1-安装mariadb

写启动脚本

Step2-安装nginx

  1. 修改配置

    server {
        listen       80;
        server_name  localhost;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
    
        access_log  logs/host.access.log;
    
        location =/ {
            root   html;
            #index  baidu.html;
           index  index.html index.htm;
        }
    
        location ^~ /baidu {
            root           html;
            index          baidu.html;
        }
    
        location ~* /phpmyadmin {
            root           html;
            #index          index.php;
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME   /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
  2. 写启动脚本

Step3-安装php

检查nginx.conf中的 127.0.0.1:9123 端口并没有监听。

location ~* /phpmyadmin {
            root           html;
            #index          index.php;
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME   /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

安装PHP-FastCGI

https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/

todaygood commented 5 years ago

Issue

image

Solution

https://stackoverflow.com/questions/10646655/the-mysqli-extension-is-missing-please-check-your-php-configuration

修改如下

extension_dir = "C:\Software\php-7.3.1-Win32-VC15-x64\ext"
extension=mbstring
extension=exif      
; Must be after mbstring as it depends on it
extension=mysqli
todaygood commented 5 years ago

设置mariadb初始化密码

MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> update user set password=password('123456') where user='root';

PS C:\Software\mariadb-10.3.11-winx64\bin> .\mysql.exe -u root -p
Enter password: ******
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.11-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
todaygood commented 5 years ago

按照这个配置 http://www.php.cn/php-weizijiaocheng-357397.html

image

出现这个问题,查了一下,应该是phpMyadmin和php 的版本配套引起。

todaygood commented 5 years ago

issue


Warning in .\libraries\classes\Config\FormDisplay.php#658
 "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Backtrace

.\vendor\composer\ClassLoader.php#444: include()
.\vendor\composer\ClassLoader.php#322: Composer\Autoload\includeFile(string 'C:\\Software\\nginx-1.15.8\\html\\phpmyadmin\\vendor\\composer/../../libraries/classes\\Config\\FormDisplay.php')
Composer\Autoload\ClassLoader->loadClass(string 'PhpMyAdmin\\Config\\FormDisplay')
.\libraries\classes\Config\Forms\BaseForm.php#16: spl_autoload_call(string 'PhpMyAdmin\\Config\\FormDisplay')
.\vendor\composer\ClassLoader.php#444: include(.\libraries\classes\Config\Forms\BaseForm.php)
.\vendor\composer\ClassLoader.php#322: Composer\Autoload\includeFile(string 'C:\\Software\\nginx-1.15.8\\html\\phpmyadmin\\vendor\\composer/../../libraries/classes\\Config\\Forms\\BaseForm.php')
Composer\Autoload\ClassLoader->loadClass(string 'PhpMyAdmin\\Config\\Forms\\BaseForm')
.\libraries\classes\Config\Forms\User\FeaturesForm.php#12: spl_autoload_call(string 'PhpMyAdmin\\Config\\Forms\\BaseForm')
.\vendor\composer\ClassLoader.php#444: include(.\libraries\classes\Config\Forms\User\FeaturesForm.php)
.\vendor\composer\ClassLoader.php#322: Composer\Autoload\includeFile(string 'C:\\Software\\nginx-1.15.8\\html\\phpmyadmin\\vendor\\composer/../../libraries/classes\\Config\\Forms\\User\\FeaturesForm.php')
Composer\Autoload\ClassLoader->loadClass(string 'PhpMyAdmin\\Config\\Forms\\User\\FeaturesForm')
.\libraries\classes\Config\Forms\BaseFormList.php#123: spl_autoload_call(string 'PhpMyAdmin\\Config\\Forms\\User\\FeaturesForm')
.\libraries\classes\UserPreferences.php#48: PhpMyAdmin\Config\Forms\BaseFormList::getFields()
.\libraries\classes\Config\PageSettings.php#80: PhpMyAdmin\UserPreferences->pageInit()
.\libraries\classes\Config\PageSettings.php#210: PhpMyAdmin\Config\PageSettings->__construct(string 'DbStructure')
.\libraries\classes\Controllers\Database\DatabaseStructureController.php#156: PhpMyAdmin\Config\PageSettings::showGroup(string 'DbStructure')
.\db_structure.php#38: PhpMyAdmin\Controllers\Database\DatabaseStructureController->indexAction()

用最新的phpMyAdmin 版本4.8.3 之后,就没有了。

image