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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。