We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

GOT "SQLSTATE[HY000] [2002] Operation now in progress" WHEN using Phalcon's Pdo

NEED HELP!

I'm installing a new phalcon environment on Centos. While creating a new Phalcon\Db\Adapter\Pdo\Mysql Object, I got this Exception:

"SQLSTATE[HY000] [2002] Operation now in progress"

The code as follows:

$dbclass = 'Phalcon\Db\Adapter\Pdo\' . $db_config_common->adapter;

$db = new $dbclass(array(
    "host"     => $db_config->host,
    "username" => $db_config->username,
    "password" => $db_config->password,
    "port"      => $db_config->port,
    "dbname"   => $db_config->name,     
    "charset"   => $db_config_common->charset
));

I've tried Version 2.0.9 & 2.0.1, no difference. Notice I've developed on other machines for a while with 2.0.1 with the same code, it runs ok there.

php version is 5.5.25(new machine) vs 5.5.29 mysql-serv version is 5.0.x(new machine) vs 5.6.x

And I've tried the raw php Pdo Object with the same parameters, It can connect successfully. Strainge.

Thanks a lot


Updates

formatted.

The mysql parameters are tested ok while connect with mysql-client on bash, but in phalcon still not work.

I notice NOT really the NEW opreation caused this exception, but calling findFirst method(or others) on a Model. Sorry.

I'm now trying to reinstall the total develop environment, hope it works.


Reinstalled dev-environment, and phalcon is OK now. Cheers~

Before reinstallation, My last test shows the following strange behavior in this case, which should be the most exactly infos:

  1. When running new Phalcon\Db\Adapter\Pdo\Mysql(...) in a standalone test script, no Exception was thrown;
  2. When running $di->set('db', function(){ return new Phalcon\Db\Adapter\Pdo\Mysql(...); }), the above Exception occurs;
  3. In my resintalled environment, with the same code, everything is ok again, so i think it's none of business about code.

Anyway, cheers again & thanks for help:)

Put it in markdown pls, show us config maybe. You just have exception after executing this code ?



2.4k

Put it in markdown pls, show us config maybe. You just have exception after executing this code ?

Actually the exception is thrown after I called Model::find/findFirst/... method. Sorry to mis-describe the case yesterday.



2.4k

Temporary get through by reinstalling dev-environment, THX for help:)

Put it in markdown pls, show us config maybe. You just have exception after executing this code ?