This topic is locked
[SOLVED]

Uncaught Error: Call to undefined function pg_escape_string()

2/4/2022 10:50:40 PM
PHPRunner General questions
B
binarykevin author

I did all of the below 2x. Same exact results.
I transfered my setup to new hardware because dev was taking WAY too long
I7 (11800 Tiger) 8 core, 40GB, 1T SSD
Windows 10
PHP 10.7
Postgresql 13.x
(I upgraded and then downgraded to/from Postgresql 14.x)

Copied my project over
Backed up and restored the database (no errors)

I get an error now and can't find where the configurationn issue is. I'm not that talented in php.
I think this phprunner app supplies the login credentials but I'm not sure if the array values are corret?
Why would phprunner be generating bad connection info? This is basic stuff, I just hitting a block.

http://localhost:8086/login.php

Fatal error: Uncaught Error: Call to undefined function pg_escape_string() in R:\output\connections\PostgreConnection.php:29 Stack trace: #0 R:\output\connections\Connection.php(54): PostgreConnection->assignConnectionParams(Array) #1 R:\output\connections\PostgreConnection.php(18): Connection->construct(Array) #2 R:\output\connections\ConnectionManager.php(91): PostgreConnection->construct(Array) #3 R:\output\connections\ConnectionManager_base.php(95): ConnectionManager->getConnection('Tables') #4 R:\output\connections\ConnectionManager_base.php(115): ConnectionManager_Base->byId('Tables') #5 R:\output\include\appsettings.php(894): ConnectionManager_Base->getDefault() #6 R:\output\include\dbcommon.php(90): include('R:\output\inclu...') #7 R:\output\login.php(5): require_once('R:\output\inclu...') #8 {main} thrown in R:\output\connections\PostgreConnection.php on line 29

PostgreConnection.php:29

/**

  • Set db connection's properties
  • @param Array params
    */
    protected function assignConnectionParams( $params )
    {
    parent::assignConnectionParams( $params );

#29 $host = pg_escape_string( $params["connInfo"][0] ); //strConnectInfo1
$user = pg_escape_string( $params["connInfo"][1] ); //strConnectInfo2
$password = pg_escape_string( $params["connInfo"][2] ); //strConnectInfo3
$dbname = pg_escape_string( $params["connInfo"][4] ); //strConnectInfo5
$options = $params["connInfo"][3]; //strConnectInfo4

$this->connstr = "host='". $host .
"' user='". $user .
"' password='". $password .
"' dbname='". $dbname .
"' ".$options;
}
B
binarykevin author 2/5/2022

I uninstalled/reinstalled PHPRunner 10.7. I get a new (related) error.

Warning: pg_connect(): Unable to connect to PostgreSQL server: authentication method 10 not supported in R:\output\connections\PostgreConnection.php on line 62

Fatal error: Unable to connect in R:\output\connections\Connection.php on line 668

B
binarykevin author 2/5/2022

Resolved.
After spending 2 days searching, I decided to use my own Apache2 / PHP / Postgres 14 stack.
I have full control now. I know where everthing is and where it needs to go.
The error is still there if I use the Internal PHPRunner webserver.

I don't know why this happened, but I found a solution to continue working.

Thanks.