Skip to content

Instantly share code, notes, and snippets.

@stevenrombauts
Last active May 20, 2020 12:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenrombauts/6455cd24ade4e1c57d5724cdbfdde216 to your computer and use it in GitHub Desktop.
Save stevenrombauts/6455cd24ade4e1c57d5724cdbfdde216 to your computer and use it in GitHub Desktop.
Running phpmyadmin with built-in PHP server

Run phpmyadmin with PHP built-in server

  1. Go to the directory where you want to create the project, for example

    cd ~ # go to your home directory
    mkdir phpmyadmin # create a new director for phpmyadmin
    cd phpmyadmin # go into the directory
    
  2. Use Composer to install PhpMyAdmin:

    composer create-project phpmyadmin/phpmyadmin:^5.0 . # mind the "dot" at the end!
    
  3. Copy the sample config file:

    cp config.sample.inc.php config.inc.php
    
  4. Start the built-in PHP server to serve the phpmyadmin app:

    php -S localhost:8081
    
  5. Go to localhost:8081 to open PhpMyAdmin. Use your MySQL credentials to log in. These are the same as your DB_USERNAME and DB_PASSWORD in the .env file for our HIVSET project.

  6. When done, press Ctrl+C to close down the PHP built-in server.

Bonus points: automatically login

  1. Open the PhpMyAdmin config file config.inc.php

  2. Look for these lines:

    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    
  3. Replace with:

    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'db username';
    $cfg['Servers'][$i]['password'] = 'db password';
    
  4. Save, start the PHP server again and go to localhost:8081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment