(done) Postgres - undefined function pg_escape_string

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

(done) Postgres - undefined function pg_escape_string

Postby KCarterSr » May 31st, 2018, 1:48 pm

Im trying to use the postgres database in my VS, project and im getting the error, undefined function pg_escape_string(). apparently/MAYBE it needs the Postgres version of libpq.dll.

Note: the web app is working fine in VS, until it get's to that function call.

I FOUND THIS COMMENT VIA GOOGLE,
-------------------------------
The PHP extension will look for libpq.dll which is found of your PostgreSQL installation. The simple fix is to add the path than contains that file to your environment PATH.

add to your enviroment variable "PATH" the bin folder of PostgreSQL installation: C:\Program Files\PostgreSQL\9.2\bin; (for example)
--------------------------------------

I tried that, but it didn't work. At least for IIS Express. I don't know.

Can anybody help?

K. Carter Sr.
KCarterSr
 
Posts: 1
Joined: May 31st, 2018, 12:44 pm

Re: Postgres - undefined function pg_escape_string

Postby emsmith » July 31st, 2018, 2:36 pm

The postgresql functions need the postgresql extension enabled. This is not turned on by default. So a couple of questions.

Did you edit your php.ini file to enable the extension? (Tools Menu -> options -> PHP Tools -> Interpreter gives you an easy way to get to your php.ini file from visual studio)

Are any of the other postgresql functions available?

Are you using at least Postgresql database version 7.2?

When you run php -m from the command line what do you see? Is pgsql on the modules list from that command?

All of this is related to how you installed and set up PHP :)
emsmith
 
Posts: 12
Joined: November 29th, 2017, 8:02 pm

Re: Postgres - undefined function pg_escape_string

Postby Jakub Misek » August 6th, 2018, 1:18 pm

HI,

indeed;

IntelliSense and the editor knowns `pg_*` functions however you have to enable it in your php.ini in order get it enabled in run time.

I hope it helps,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 43 guests

cron

User Control Panel

Login

Who is online

In total there are 43 users online :: 0 registered, 0 hidden and 43 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 43 guests