Skip to content

Instantly share code, notes, and snippets.

@tashrifbillah
Last active March 8, 2022 16:20
Show Gist options
  • Save tashrifbillah/df02221bb250a639dbce28384b516ee4 to your computer and use it in GitHub Desktop.
Save tashrifbillah/df02221bb250a639dbce28384b516ee4 to your computer and use it in GitHub Desktop.
Essentials of launching PNL website from local mysql database

1. Create mysql database and user

$ mysql -u root -p
(provide your mysql root password to log in to mysql shell)
mysql> create database pnl
mysql> use pnl;
mysql> CREATE USER 'pnl'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';
mysql> grant all privileges on pnl.* to 'pnl'@'localhost';

2. Load the dumped database

The database name is pnl.

$ mysql -u pnl -p pnl < pnlc7.sql
(provide YourPassword to log in to mysql shell)
(takes ~15 seconds)

$ mysql -u pnl -p pnl

mysql> use pnl;
mysql> show tables;
+------------------------+
| Tables_in_pnl          |
+------------------------+
| pnl_commentmeta        |
| pnl_comments           |
| pnl_links              |
| pnl_options            |
...
...

3. Untar our website

My tar ball will unzip to /var/www/html/. So I suggest backing up your html/. Feel free to work around it however way you prefer without backing up your html/.

wget dropbox_link
cd /var/www/
mv html html.bak
tar -xzf pnl-local-website.tar.gz

4. Launch php

php -c /path/to/your/config.ini -S 127.0.0.1:9000 -t /var/www/html/

5. Install database

http://127.0.0.1:9000/wp-admin/install.php

DB_HOST: 127.0.0.1
DB_NAME: pnl
DB_USER: pnl
DB_PASSWORD: YourPassword
table_prefix: pnl_

The above are the credentials you need to establish database connection. If wp-admin/install.php does not work for you, feel free to follow any method from https://wordpress.org/support/article/how-to-install-wordpress/#setup-configuration-file .

Note: DB_HOST: localhost did not work for me.

6. See our website

http://127.0.0.1:9000

Appendix

  • Database connection troubleshooting (if needed)

Save MySQLi Procedural code as /var/www/html/test.php and see if you can load http://127.0.0.1:9000/test.php in your browser.

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