Is it possible to connect PHP to an old version of mysql server (3.23)?

Asked

Viewed 80 times

-3

I’m doing this:

$conexao = mysql_connect($servidor, $usuario, $senha, $db);
if (!$conexao) {
  die('Não conectou: '.mysql_error());
} 
echo "Conectou";

And the error message is this:

Connecting to 3.22, 3.23 & 4.0 Servers is not supported.

I can’t change Mysql Server, there’s something I can do to connect?

  • I believe that PDO connects with mysql version 4, but only by testing https://www.php.net/manual/en/pdo.connections.php -- confirms me if this is it.

  • I tried with PDO and the following error appears: SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 Servers is not supported

  • Dear Teixeira, I believe that only using a separate technology, for example mysql via line command + o exec() of PHP. Perhaps I formulate an answer or example and post again here, but apart from that I believe it will be impossible without using something from third parties, at least from third parties so far I have not found anything that is good, I even found a code, but it is terrible, full of problems, that is exec+mysqlcli, But it doesn’t pay and I feel responsible to post only good or reasonable things, things with a lot of problems would be irresponsible on my part. As soon as possible I will see this.

  • Thanks anyway. I’m not allowed to update the server, but I have to make some modifications to the site. These modifications are simple, but setting up a server to test before you go online is giving me a headache.

  • I found some cases on google that solved using mysqli_connect instead of mysql_connect.

  • Unfortunately it gives the same error.

  • @Benilson I believe it was something else, it must not have been exactly because of the mysqli or the PDO, it must have been a matter of version and driver, but neither I will enter this merit and nor is it useful to kick alternatives without knowing if they are effective, after all we are not technical support, we have to look for what is right for the author and future visitors... Dear Teixeira I did not suggest changing anything on the server, I suggested an idea of PHP script even if it uses mysql per command line and this is usually already standard in the hosts, so q have a time step here to talk better.

  • @Guilhermenascimento most situations can be tested by the person who tries to help, but Teixeira has a higher degree of complexity, for most of the OS users, it is not possible to simulate the problem he is having. In order to help, we can only conjecture based on some knowledge or research, or do nothing. For example now I would suggest that he try to use a connection ODBC, by using generic drives to access the database, but I have no way to say it will work.

  • @Benilson this there is what we call Helpdesk, usually the question in this scenario is closed, but anyway I’m just trying to give a help to him, the rest I said was superficial, may or may not help future people, but it will depend on the "solution", if there is anything q is at least decent to solve, anyway mysqli will not solve the case, because the driver is not compatible nor in different Apis.

Show 4 more comments

1 answer

0

The problem is that you are using a drive that has no support for the version of mysql you want to connect:

Possible causes:

  1. When we use a xampp, wamp server .... Already comes along the drivers, which are set in the OS, it seems that you have the remaining Mysql driver of PHP 4.4, because that’s what causes this error message.
  2. When reinstalling other versions of newer PHP along with older versions, there is a conflict between versions, as not all environment variables are configured when installing other versions of PHP

But summarizing is just incorrect references between the mysql installed and the drive set in the environment.

  • Mysql is not PHP, it is not talking about PHP4.4, it is talking about mysql4, it has nothing to do with PHP conflicts, it has to do with the mysql version, which can be anywhere/server. I think PDO can connect with older versions (I couldn’t test), at least with mysql4

  • So @Guilhermenascimento if you don’t know, have you heard of php.ini? In it you can enable and disable resources, and one of them the connection drives, so there is a reference between the PHP that it is using and the environment configuration, as I said, if there is an old mysql drive configuration set in its environment there may be a conflict.

  • Example: php.ini (Extension=pdo_mysql). Which version? (reply) The setting in the environment. Got it?!

  • Two versions of php do not communicate "directly", so this is not the problem você tem o driver MySQL restante do PHP 4.4, probably using either php5.6 or 7+, the mysql driver (API independent) no longer has support for older versions of mysql, I even imagined that PDO followed a different path, but it was a mistake, it seems that it also does not support, maybe an extra tool the part would solve, but the author has no way to install it on his server, so there’s no way to quote here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.