I am running postgresql on Centos 7 as well as hosting a website which uses data from the postgresql database. I am using PHP. Everytime I try to access any data from a browser screen it returns the following error:
Warning: odbc_connect(): SQL error: [unixODBC]Could not connect to the server; Could not connect to remote socket immedaitely, SQL state 08001 in SQLConnect in /var/www/html/_210db/dbms_fns.php on line 5
I would really appreciate some advice on how to correct the problem that I have encountered. If you need any other configuration files I will send them.
The web site used to work using centos 5.
Thanks for any help you can give me.
Hugh Krenske
ODBC files are
/etc/odbcinst.ini
# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbcw.so
#Driver64 = /usr/lib64/libodbcpsqlS.so.2.0.0
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
/etc/odbc.ini
[rbcn]
Description = Environment database
Driver = PostgreSQL
Trace = 1
TraceFile = /var/log/sql.log
Database = rbcn
Servername = gudgeon2
Username = tell
Password = tell.01
Port = 5432
Protocol = 6.4
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =
Runnning some tests have produced the following results:
# isql -v rbcn
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Programs installed on my Centos 7 server are:
# yum list installed | grep ODBC
unixODBC.x86_64 2.3.1-11.el7 @base
# yum list installed | grep odbc
libiodbc.x86_64 3.52.7-7.el7 @anaconda
php-odbc.x86_64 5.4.16-43.el7_4 @updates
postgresql-odbc.x86_64 09.03.0100-2.el7 @base
# yum list installed | grep postgres
postgresql.x86_64 9.2.23-3.el7_4 @updates
postgresql-docs.x86_64 9.2.23-3.el7_4 @updates
postgresql-libs.x86_64 9.2.23-3.el7_4 @updates
postgresql-odbc.x86_64 09.03.0100-2.el7 @base
postgresql-server.x86_64 9.2.23-3.el7_4 @updates
odbc problem using PHP
Re: odbc problem using PHP
Try setsebool -P httpd_can_network_connect_db 1
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: odbc problem using PHP
Thank you so much. I have struggled with this for days. Now in my 70s, I support local environment groups with a way that they can collectively record the work they have done and easily search on historic data. I presume that by leaving out the -P in the line will make the change permanent across reboots.
Again many thanks.
Again many thanks.
Re: odbc problem using PHP
The opposite, the -P makes it permanent, without it it only lasts for one boot.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke