IIS 7 and Above
IIS8 PHP Remote MySQL Connection Timeout
Last post Mar 20, 2019 03:13 AM by Jalpa Panchal
Mar 11, 2019 02:03 PM|Keatran|LINK
So I'm moving a PHP application to IIS and I have it set up for the most part but a really strange error I can't work out.
PHP is unable to connect to a remote Database Server from our WebHost, what is really strange is Via RDP to our WebHost Server I'm able to run MySQL Workbench and connect to the remote server using the details from PHP.
So PHP is always giving me a Timeout error, workbench connects in record time.
So workbench had the details copied and pasted from the PHP sites config, so i know they are correct. Why is PHP configuration in IIS not able to connect?
Mar 12, 2019 01:57 AM|Jalpa Panchal|LINK
First thing you could try to pinging server.
Where "servername" is the same string that you put in your PHP script above. If this does not reply with a string similar to the one below, specifically, the first word is not "Reply":
Reply from 192.168.239.132: bytes=32 time=101ms TTL=124
This means that there is no connectivity between the computer running the PHP script an the mysql server.
Then check if the server and the computer are properly connected to the network, if the server is up, an if there is not firewall in your computer running the PHP script or on the server.
You might need to disable a firewall in your Mysql server, a firewall in your computer running PHP, or enable the Mysql server to accept remote connections for the database and username that you use in your PHP script (some distributions Mysql server are
installed to only accept local connections for safety).
If the problem is a permission in the server (the user can only connect locally but not from a remote computer for instance), you can enable the permission in the Mysql server with the GRANT command:
Mar 14, 2019 11:03 AM|Keatran|LINK
Are you joking right?
Ping is an ICMP request when MySQL uses TCP (even windows firewall by default block all ICMP and still allow Specific TCP Ports) further to that Iknow the windows server can talk to the DB server because WORKBENCH IS WORKING. as that screenshot shows. So ping
does not show anything about a connection to the server via the internet i know for a Fact that the Database Server does not respond to ICMP ping requests.
The IIS Server with PHP installed is the same server I'm using workbench on, so I know that this server can connect to the Database Server. It seems to be IIS or PHP IIS Configuration that is broken, but this is using the defaults from Web Platform Installer.
Mar 15, 2019 01:44 AM|Jalpa Panchal|LINK
Sorry for misunderstanding. could you share your connection string?
Mar 15, 2019 11:03 AM|Keatran|LINK
There is no connection string PHP uses an Object called MySQLi to connect to a DB and I know it works even if there was a connection string i would not share it as it exposes username, password and server address which would allow anyone reading this forum
to connect I copied and pasted the details from the PHP file into Workbench so I know it's correct.
Mar 20, 2019 03:13 AM|Jalpa Panchal|LINK
You could share after removing sensitive information from string.