php migration from 2003 server to 2012 not connecting to SQL server - php

I'm moving some php sites backed by SQL from a 2003 server to a 2012R2 server. I haven't had time to update code to use a newer php version so am using 5.2.10. I have everything working except I can't get a connection to the SQL server - the latter has not changed.
The errors I'm getting are:
PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server...
PHP Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in...
How can I verify that mssql_connect and mssql_select_db are working? Or do those errors mean that they are? The credentials are the same as those on the currently working server to be replaced so I'm fairly certain that's not it but if I can be assured that the php side is working, I'll invest my attentions back to SQL and/or a possible network issue (although they're on the same network behind a firewall so that shouldn't be it)
I'm stuck with what to do next.

Related

Intermittent/random `Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (60)`?

A little background: I had to upgrade a service from PHP 5.6 to PHP 7.4. Database module was using old mysql_* functions, so the the first step was to replace them by mysqli_* and look for possible bugs, at the end it worked fine on local development environment.
As there weren't any visible bugs while testing phase, it was released to a test server. Then it started randomly an intermittently to log the following warning:
(HY000/2003): Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (60)
If you check database server at that moment it replies OK, it is not down. Also there are other 3 servers online hosting the same service and they don't show the described problem meaning database server is online and running.
Also does the 60 surrounded by parentheses means something? I know it corresponds to MySQL's Global Error Message but error number 60 (EE_SSL_ERROR) wasn't added until version 8.0.13. Could it means the same in MySQL 5.6?
After some digins and tests we (team) finally discovered it was related to client library connecting to older server.

Connection error to sql server when doing massive queries with sqlsrv

i was wondering if anyone knows why i am getting the following error.
I have an application doing massive queries to a SQL 2008 Server. The main application runs over PHP on linux , I call many php scripts simultanously to a windows server running PHP over xampp, this server queries the sql database and this is where I am getting the error.
On this windows server I hava PHP 5.4.4 with the sqlsrv extension. I have the sql server configured to handle unlimited connections. however when I send many API calls (thousands) i eventually start getting connection errors like the one below,
Unable to connect to server
I read that mssql conection can be tuned with the max_procs config, however I am using sqlsrv extension instead and I havent found any info regarding this .
Has anyone experienced this issue before.
Thanks in advanced.

PHP Unable to connect to MS SQL server

I have used default MS SQL driver to connect to a SQL server in a php application.
I'm using XAMPP 1.6.8. my php version is 5.2.6.
Application was connected successfully to the SQL server and the application was running successfully for a long time. Now suddenly the application is showing an error on mssql_connect() function with same MS SQL access information.
the error is "Unable to connect to server: xxx.xxx.xxx.xxx"
I also checked the SQL server access info with a SQL client. SQL client can connect successfully, therefore i think the access info is correct.
Can any one help me resolved this issue?
Thx
I just found my solution here. http://jimmyli.net/2009/03/php-unable-to-connect-to-mssql/ .problem was that the file ntwdblib.dll packaged with PHP5 was an old version. then i just replace with updated one from here http://jimmyli.net/wp/wp-content/uploads/2009/03/ntwdblib.zip
Thx

Php service set up error

while I try to connect to php service in flex I got an error like this.(I gave root,password,database name everything correctly)
Warning: mysqli_connect() [<a href='function.mysqli-connect'>function.mysqli-connect</a>]: MySQL server has gone away in C:\wamp\www\harisample\services\SamplePhp.php on line 54
When you receive a MySQL server has gone away error, it means that one of the following is happening:
The client couldn't send a question to the server.
The client didn't get an error when writing to the server, but it
didn't get a full answer (or any answer) to the question.
You tried to run a query after closing the connection to the server. This indicates a logic error in the application that should be corrected.
A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that host.
The MYSQL_OPT_READ_TIMEOUT or MYSQL_OPT_WRITE_TIMEOUT variables are too low
You have encountered a timeout on the server side and the automatic reconnection in the client is disabled (the reconnect flag in the MYSQL structure is equal to 0).
You are using a Windows client and the server had dropped the connection (probably because wait_timeout expired) before the command was issued.
Fixing this can be simple, but only if you have full root access to your server.
You can change the time limit by setting the wait_timeout variable when you start mysqld. See this link for more information.
If you have a script, you just have to issue the query again for the client to do an automatic reconnection. This assumes that you have automatic reconnection in the client enabled (which is the default for the mysql command-line client).

Using PDO with 2 databases Intermittent error SQLSTATE[HY000] [2005] Unknown MySQL server host

Most of the time it works fine. Sometimes I refresh the screen once and it works and sometime I have to wait a few minutes. I have also gotten up and tried it on a different pc and it appears that if it is not working on one computer it is not working any where.
The program opens the databases in the same order each time and the error has occurred on both the first and the second database.
I have not seen a pattern.
I am using godaddy.com shared hosting.
PHP Version 5.2.17
PDO Driver for MySQL, client library version 5.0.77
Any advice would be appreciated.
If you're connecting via TCP sockets, this could be due to an intermittent DNS lookup failure. e.g. your connection string uses 'mysql.example.com:3306', and whatever DNS server(s) your host is configured to use fails for whatever reason.

Categories