PHP pgsql doesnt load from command line












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.










share|improve this question

























  • 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.

    – pr1nc3
    Nov 13 '18 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.

    – Tom.J
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 8:57











  • Also you are missing a double quote at the end.

    – pr1nc3
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 9:05


















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.










share|improve this question

























  • 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.

    – pr1nc3
    Nov 13 '18 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.

    – Tom.J
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 8:57











  • Also you are missing a double quote at the end.

    – pr1nc3
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 9:05
















0












0








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.










share|improve this question
















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.







php postgresql cmd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 8:59







Tom.J

















asked Nov 13 '18 at 8:51









Tom.JTom.J

14




14













  • 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.

    – pr1nc3
    Nov 13 '18 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.

    – Tom.J
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 8:57











  • Also you are missing a double quote at the end.

    – pr1nc3
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 9:05





















  • 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.

    – pr1nc3
    Nov 13 '18 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.

    – Tom.J
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 8:57











  • Also you are missing a double quote at the end.

    – pr1nc3
    Nov 13 '18 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.

    – coladict
    Nov 13 '18 at 9:05



















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.

– pr1nc3
Nov 13 '18 at 8:52







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.

– pr1nc3
Nov 13 '18 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.

– Tom.J
Nov 13 '18 at 8:55





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.

– Tom.J
Nov 13 '18 at 8:55




1




1





run php -m to list the loaded modules. If pgsql is not there, then the problem is in the php configuration used.

– coladict
Nov 13 '18 at 8:57





run php -m to list the loaded modules. If pgsql is not there, then the problem is in the php configuration used.

– coladict
Nov 13 '18 at 8:57













Also you are missing a double quote at the end.

– pr1nc3
Nov 13 '18 at 8:57





Also you are missing a double quote at the end.

– pr1nc3
Nov 13 '18 at 8:57




1




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.

– coladict
Nov 13 '18 at 9:05







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.

– coladict
Nov 13 '18 at 9:05














1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277084%2fphp-pgsql-doesnt-load-from-command-line%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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.






    share|improve this answer




























      0














      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.






      share|improve this answer


























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 8:09









        Tom.JTom.J

        14




        14






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277084%2fphp-pgsql-doesnt-load-from-command-line%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Hercules Kyvelos

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud