Skip to content

How to set password here? #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abkiran opened this issue Feb 21, 2018 · 3 comments
Open

How to set password here? #1

abkiran opened this issue Feb 21, 2018 · 3 comments
Labels

Comments

@abkiran
Copy link

abkiran commented Feb 21, 2018

'pass' => 'lib' . DS . '.ht_pw', // MySQL password override

Also if you move this to a separate conf.php, it will be nice

@markc
Copy link
Owner

markc commented Feb 21, 2018

This one is meant to be a super simple plain text one-off password for the MySQL settings mainly to avoid hard wiring a password in index.php so the project could be safely updated in a public git repo without revealing the MySQL password (if used). The separate optional override config file you mention is really...

$file = 'lib' . DS . '.ht_conf.php', // settings override

That file can override, or add to, all the "global" config variables in the index.php file. The lib/.ht_pw is just a simple alternate "mysql password only" option to the main config override file. I hope this makes sense.

Update: sorry, I didn't answer your question in the Subject line... it's just plain text, not a PHP variable or enclosed in quotes, just My_Mysql_Password. It's used here like this...

$pass = file_exists($pass) ? trim(file_get_contents($pass)) : $pass;

@abkiran
Copy link
Author

abkiran commented Feb 22, 2018

/var/www/kk/php7/spe/08-Users/lib/php/db.php 27
SQLSTATE[HY000] [1045] Access denied for user 'sysadm'@'localhost' (using password: YES)

-- All the time error

@markc
Copy link
Owner

markc commented Feb 22, 2018

In index.php, change this line to whatever you MySQL password should be, from...

'pass'  => 'lib' . DS . '.ht_pw',

to...

'pass'  => 'YOUR_MYSQL_PW',

and in lib/php/db.php change line 12 from...

error_log(__METHOD__);

to

error_log(__METHOD__ . ' dbcfg=' . var_export($dbcfg, true));

and check your web servers error_log file for the database config entries passed into this class.

'pass' => 'lib' . DS . '.ht_pw', is only needed if you want to push this modified project back to a public git repo so that the MySQL password is not visible. The default .gitignore excludes all .ht* files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants