• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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