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 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体