Reputation: 371
I am trying to get a connection between my php-fpm docker container and an RDS Postregsql. I found that I was getting an error in my php application "call to undefined function pg_connect()". So I thought that maybe the issue was that I didn't have pgsql driver enabled in my php.ini. So I tried to enable it, by first adding a line to my Dockerfile, rebuilding the image, then I brought down the container and brought it up again. But I am getting the same error "call to undefined function pg_connect(). So I'd like to run phpinfo() in the container to see if the pgsql driver is loaded. I tried to run it by using docker exec 4822 /bin/bash to open a cli to the container, but the host cli just comes back with a $. How can I run phpinfo() in the container so I can figure out why $DB2 = $this->load->database('postgres', TRUE) is failing with the above error? I am using Codeigniter and here is the connection array:
enter code here
enter code here
Sorry I can't get the format going. Anyway, here is the dsn 'dsn' => 'jdbc:postgresql://imagesdatabase.cwymdn16cxes.us-east-1.rds.amazonaws.com:5432/postgres'
Upvotes: 0
Views: 4817
Reputation: 371
Well I finally realized that since my under development is php why not just insert phpinfo() into the start up. I did that and it works great! All that effort just to confirm that the pgsql driver is not loaded! At this rate it will take me the rest of my life to finish my application 😀.
Upvotes: -1
Reputation: 7769
Follow this https://www.php.net/manual/en/features.commandline.interactive.php
This will help you, how to use interactive command line PHP
.
If DockerImage
is based on PHP
or has PHP installed
in docker container
then you can use this feature. What you need to do in docker terminal
is run following command
$ php -a
Interactive shell
php > echo 5+8;
13
Upvotes: 1
Reputation: 3034
From the $ prompt:
php
should start the PHP process. Then:
<?php phpinfo();
will display phpinfo() output. You will need to end the php process with a Control-D and then all output should be displayed.
Upvotes: 3