• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Resolved (bug ?) mysql_pconnect() fails if password contains $

AdrianC

Basic Pleskian
Plesk 17.5.3 on Centos.
I just noticed that if my database password contains "$" I get "access denied for user@localhost" error in PHP.
It works to connect just fine from other database tools, but in PHP I get db connection error.
I think also Plesk uses "$" when generating a random password.
You might want to fix that because for us it can be a pain to debug.
 
This is no bug in plesk, but normal php string behaviour.
$ is interpreted as the start of a variable in php. So when that is in a password, you need to escape it.

$_DB["password"] = "mypas$word"; translates for php in mypas + the content of the variable $word, as $word is not initialized or filled, it will be empty and the password you pass to mysql will be in this case: mypas .... resulting in an error.

it should be

$_DB['password'] = 'mypas$word'; (single quotes)
or
$_DB['password'] = "mypas\$word"; (escape the $)

Personally i find using single quotes less error prone.

regards
Jan
 
Well that's embarrasing, I was fully aware of all the above but I didn't realise it :)
Thanks.

// Maybe it would still be good for Plesk to avoid generating passwords containing $, as a precaution.
 
Back
Top