0

I saw a similar question "Loads only from the command line". I have a different issue and on windows OS. I need to test some parts of code that has connections to other HTTPS sites, and I assume my browser caches some stuff that drops an error for the output. There for, I need to test my php script with a windows command line - which isnt hard to do. How ever, on pg_fetch_all it drops Call to undefined Function pg_fetch_all.

But I assume it connects to the database using pg_connect, otherwise it would drop an error before hand.

Is there something I am missing? Does pg_fetch_all has some values that I missed on reading about it? Or its simply because it is not loading a plugin, etc..

  • I am using PHP5.6
  • Loading it with simply: php file.php

My code for SQL as requested.

$station_keys = pg_fetch_all(
   pg_query(
      get_connection(), "SELECT val, val2, val3, val4 FROM table_keys"));

Everything works fine on browser (maybe apache's doing), the command line thinks it's weird.

My php -m prints out:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]

pdsql is missing, it is enabled on wamp, it doesn't load when I am running command line.

7
  • Share you code with us so we can have a look. Otherwise we can only guess and i don't think it will be beneficial for you. Commented Nov 13, 2018 at 8:52
  • Not sure how will it make a situation any different, it runs on browser (That bit), the issue is the command line, not the script itself. Commented Nov 13, 2018 at 8:55
  • 1
    run php -m to list the loaded modules. If pgsql is not there, then the problem is in the php configuration used. Commented Nov 13, 2018 at 8:57
  • Also you are missing a double quote at the end. Commented Nov 13, 2018 at 8:57
  • 1
    Running php -i will tell you exactly where the CLI is looking for a php.ini configuration. It will also tell you a whole bunch of other stuff we don't need for this. You need to change it to load the pgsql extension. Hopefully it will come pre-compiled somewhere for you. Commented Nov 13, 2018 at 9:05

1 Answer 1

1

I solved the problem using Coladict comment, the pgsql wasn't loading in command line, since I was using 5.6 version, from the files, not wamp, it wasn't included in my php.ini config file, found the pdsql, un commented and it works like a charm, used php -m to see which plugins are currently loaded, then php -i to see where the php.ini file is located.

I suggested Coladict to answer it as an answer, so other people would see it, how ever he didn't respond.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.