- Server operating system version
- Microsoft Windows Server 2019
- Plesk version and microupdate number
- Version 18.0.49 Update #2
Hello,
We are developing an extension for Plesk in PHP and we have need of interacting with WordPress databases on Customer domains.
On Linux, we have been using the pm_Bootstrap::getDbAdapter() to make all of our requests using PDO. On Windows, however, the adapter could not interact with the database servers, erroring out saying that the table or view could not be found. After some debugging and research, I found this article (https://support.plesk.com/hc/en-us/articles/213928465-How-to-access-the-Plesk-psa-database-in-MySQL) explaining that Plesk on Windows Servers have two separate database servers that it uses. The PDO server can access the one on port 8306 no problem, but the Customers' databases that we need to access are on port 3306.
We tried using
How does one properly interact with the MySQL database server in PHP?
Thanks in advance.
We are developing an extension for Plesk in PHP and we have need of interacting with WordPress databases on Customer domains.
On Linux, we have been using the pm_Bootstrap::getDbAdapter() to make all of our requests using PDO. On Windows, however, the adapter could not interact with the database servers, erroring out saying that the table or view could not be found. After some debugging and research, I found this article (https://support.plesk.com/hc/en-us/articles/213928465-How-to-access-the-Plesk-psa-database-in-MySQL) explaining that Plesk on Windows Servers have two separate database servers that it uses. The PDO server can access the one on port 8306 no problem, but the Customers' databases that we need to access are on port 3306.
We tried using
shell_exec
, exec
, and system
functions with the command
shell_exec("\"%plesk_dir%MySQL\\bin\\mysql.exe\" -P3306 \"-u$dbuser\" \"-p$dbpassword\" -e \"$sql\"");
, but there has been no change and no error results, except result code 1 from the system
function. We verified that the server does recognize the %plesk_dir%
coming from Program Files.How does one properly interact with the MySQL database server in PHP?
Thanks in advance.