Kohana/php Headers and client library minor version mismatch - php

I have come to a very strange error, and as the title says i get:
mysql_connect(): Headers and client library minor version mismatch. Headers:50095 Library:50149
After some googling i found out that it might be caused by wrong mysql/php version, well that might be right, but the thing is i am using php framework kohana and if try to run this very simple connect code without that framework:
$sql = mysql_connect("server", "root", "passowrd") or die(mysql_error());
mysql_select_db("db", $sql);
It works just fine, so my guess is that this error is caused by php script somewhere, could it be possible? And if so, can i fix it without updating server, because it's not really possible since i'm using public rented host.
Also just in case here is the class which connects to DB: http://pastebin.com/VFtj0re6
P.S i have tried to remove all code from public function connect() function, and add my own connection code which seems to be working, but it did not help.

Related

I can't handle mysqli connect exception, because php always shows error

My problem is that I'm trying to make exception-handling, so if my page can not connect to the mysql database, it should write an error message that I made. It partly works, I can see my error message, BUT I also see two additional php errors.
Here is a picture:
Here is the code:
if(!mysqli_connect($server, $user, $passw, $db)) //line 12
$_SESSION['page'] = "conn_err";
I have tested with echo, the variables have values, they are not empty or null!
The variables are test values, so they are wrong, to test if the exception handling works. Btw., I'm on localhost, and I'm using wampserver.
Soo... I want if only that one error message would be visible I made.
I tried to solve the problem with try-catch, also tried with a connection variable and an if statement, but nothing worked. Any ideas?
Thanks!
Edit:
I forgot the versions...
PHP version: 5.5.12
Apache version: 2.4.9
MySQL version: 5.6.17

kohana db exception [0]

I have a big problem with connecting to mysql database. I tried everything and nothing worked.
If i try to connect on localhost with xampp to db on kohana (3.1.2), i get this error:
Database_Exception [ 0 ]: ~ MODPATH\database\classes\kohana\database\mysql.php [ 67 ]
but if i try run it on some server, it runs there and i dont know why, because everything is same (except db user and password).
I thought that it can be with mysql config, but i dont know what there.
I just came across this problem and figured out what it was so even though this question is old, people having this problem should know the answer.
Basically when you get this error its because your using a version of php 5.5+.
mysql_connect(...) is a depreciated function starting in php 5.5 and above so the call in the framework is wrapped around a try/catch but the output from the catch doesn't give you any details about the error for whatever reason but if you remove the try/catch you'll see the real php error is simple saying mysql_connect is depreciated and will be removed in the future and to use mysqli instead.
To fix this open index.php in your root and basically you need to change the error_reporting(...) call to tell it not to error on depreciation errors which you can do like so to report all errors except warnings and deprecations.
error_reporting(E_ALL ^ (E_WARNING | E_DEPRECATED));
Another fix is to change your database config file to connect via PDO instead of mysql.
I checked in Kohana 3.2, and there it means it can't connect to your database and throws an exception on that. But just go to the line 67 of the mysql.php file and check if the exception is triggered just after trying to connect to the DB.
Check your credentials in database config and make sure your MySQL server is up and running.

Error connecting to MSSQL with SQLSrv and PHP 5.4.7

I'm trying to connect to an MSSQL database with PHP and encounter a very frustrating error while trying to connect. It loads for a minute, before printing out the following message:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08001]:
[Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53].
Here's my connection string:
DB::config("sqlsrv:Server={$dbHost} ; Database={$dbName}", $dbUser, $dbPass);
And in my DB class:
public static function config($dsn, $user, $pass)
{
self::$_pdo = #new PDO($dsn, $user, $pass);
...// intentionally left out
I'm very baffled. I have the following module configured in my php.ini file: extension=php_pdo_sqlsrv_54_ts.dll. Although I think I installed it right and I don't receive any error message about the driver not working, this bit of PHP prints nothing:
if (function_exists( 'sqlsrv_connect' ))
echo "hey";
and as you can see from my error message above SQL Server Native Client 11 appears to be working. I'm on a Windows platform. I tried disabling the firewall to no avail. I don't have much information about the SQL server or I would share it here.
This is my first time posting on Stack, so I apologize if I'm leaving out a key piece of information or I'm not following proper etiquette in some way, but any help is definitely appreciated.
Also, I should add that I've already done too much Googling, and haven't had any success.
My install process actually worked, but the connection was indeed invalid. I should have been using the IP address as the host name, which I was not. I was also using a colon instead of a comma before the port number. Finally, no spaces can be allowed in the connection string, which I thought would be automatically stripped out. So, here's a valid connection string for those of you that may find yourself in a similar predicament:
$connectionString="sqlsrv:Server=123.123.12.1,9864;Database=mssqldatabaseWootWoot";
Also, in response to my earlier observation about that function sqlsrv_connect, I had not enabled the driver necessary for that function. It is located in php_sqlsrv_54_ts.dll, which after enabling, reported the function as existing.
Thanks to anyone who put any time into solving this.
I ran into the same problem but I found that I did not need to use the IP address, the server name worked just fime. Also I was not sure what port my server was using, I found the information here: How to find the port for MS SQL Server 2008?
I also found the following links helpful in getting PDO to work:
PHP PDO Connection to SQL Server with integrated security?
Use of PDO in classes
MS SQL Server (PDO) — Microsoft SQL Server Functions (PDO_SQLSRV)
I know ncksllvn solved his problem so I hope this helps whoever else visits!

PHP ftp_connect() fail

Very simple problem but one which I am unable to solve. Why would I get a ftp_connect() fail?
$conn = ftp_connect("www.server.com");
Have tried SSL connect. Intrestingly I had no problem with this ftp_connect() on this server until recently when I started getting error messages. Not too sure what triggered this perhaps an update as the code was not altered.
Thanks in advance
Edit: Found this in Plesk : Shell access to server with FTP user's credentials - ForbiddenHave no idea if its relevant
Ok, after lots of fiddling (asking someone else) this is the solution I found...
$conn = ftp_connect(localhost);
Well the simplest solution is the best. This works as the code is situated on the server to which it is trying to connect.

ERR_CONNECTION_RESET Error using WAMP

I have installed WAMP on my system. My localhost site works properly, but when I pass something in the URL like http://localhost/test.php?a=1 I get error like "Error 101 net ERR_CONNECTION_RESET".
Has any one experienced this same error or have a solution?
If you are trying to interface to MySQL it may be an issue with the driver...
https://serverfault.com/questions/74313/what-could-cause-an-101-error-in-wamp-under-windows-7
Check your logs to see what exactly is causing the error...
Are you sure that it is WAMP's error? I googled your error and found this: http://www.google.com/support/forum/p/Chrome/thread?tid=476f762a0f84017f&hl=en
#pradeep even I had the same problem. You should close the connection at the end of your page code using the connection resource. worked for me ... mysql_close($conn); where $conn is your mysql database connection resource variable which you have used to connect to mysql database.
Faced the same problem with WampServer 2.1 ; and basically resolved it by installing latest version of WampServer (WampServer 2.2D).

Categories