Installed CakePHP on IIS 8.5 with PHP 7.4.6 and MSSQL extensions loaded as
Running my own little testscript for PDO connections to MSSQL Server works. I can connect and I can retrieve data. However CakePHP cannot connect using the same server, database and credentials. Both CakePHP and my test script runs on the same server and under the same site. The error received from CakePHP is:
CakePHP is NOT able to connect to the database.
Connection to Sqlserver could not be established: SQLSTATE: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.
Any one else had the same issues?
Ok found the issue. There is an app_local.php that overwrite the settings in app.php. Corrected that file and now I have database access. However the setup instructions do not mention altering the app_php.local it just states " If you have config/app_local.php in your app folder, it overrides app.php configuration."
So I guess it was my own fault not reading that properly.
Generally, it happens that something is preventing a connection to the port or hostname. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that specific port. This may be because it is not running at all or because it is listening on a different port. So, no connection can be established.
Try running netstat -anb from the command line to see if there’s anything listening on the port you were entered. If you get nothing, try changing your port number and see if that works for you. In Windows operating systems, you can use the netstat services via the command line (cmd.exe) . On Linux you may need to do netstat -anp instead.
The target machine actively refused it occasionally , it is likely because the server has a full ‘backlog’ . Regardless of whether you can increase the server backlog , you do need retry logic in your client code, sometimes it cope with this issue; as even with a long backlog the server might be receiving lots of other requests on that port at that time.