douji8033 2018-11-13 08:51
浏览 182
已采纳

PHP pgsql不从命令行加载

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.

  • 写回答

1条回答 默认 最新

  • ds1379551 2018-11-14 08:09
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵