PHP5 - pgsql Module not loaded - postgresql

I am trying to get work PostgresSQL with PHP, but i stuck on that apache error:
Call to undefined function pg_connect().
When i run phpinfo() i cannot see that my module is loaded, but i do not know why. The pgsql.ini files were loaded. And when i open them, i can see, that the extension is enabled extension=pgsql.so. Under /usr/lib64/php5/extensions there is the .so file. Even the permission are same like the other modules.
Any idea what am I doing wrong?

It would help if you could describe what operating system you are using. I'm assume Linux, but which distribution? One package that is often forgotten when installing postgresql and php is php5-pgsql. This is the connection between the two. For some reason I cannot explain, it is best if all three are installed together. So I suggest uninstalling postgresql and php and then installing postgresql, php5 and php5-pgsql. I hope this works for you!

I found it out. Some libraries where not found.
1.) First of all run php -version
2.) If there is an error where it described that some libraries are missing, you can solve it like me
3.) Search for the files on your system find / -name {LIBRARY NAME}
3a.) If you found them, just create a symlink to /usr/lib64
3b.) If not, find a way to get them and 3 3a

Related

Cannot install Qt postgreSQL driver

I'm posting here with the hopes that someone will be kind enough to help me. Just to clarify, I'm sort of a newb, so I'd be really grateful if you give more details to your explanations.
I'm on Windows 10 64 bit, QT 5.9.1, PostgreSQL is 9.6.3 version.
I'm working on a project, where I need to get a postgresql database running and connect it to the code I'm doing right now. Unfortunately, when I try to install the driver, I run into all kinds of problems. I've been reading on threads on sites, but they are outdated and some folders do not match, which my first problem arises. For some reason I cannot get qmake to work, even though I edit the path in the variables.
I tried running the commands from here.
cd %QTDIR%\qtbase\src\plugins\sqldrivers\ps
ql
qmake "INCLUDEPATH+=C:/psql/include" "LIBS+=C:/psql/lib/ms/libpq.lib" psql.pro
nmake
Basically my folders don't aren't 100% as the guide, also I don't have a libpq.lib file
On my final attempt I tried the following:
qmake "INCLUDEPATH+=C:/PostgreSQL/pg96/include" "LIBS+=C:/PostgreSQL/pg96/lib/libpq.lib"
Project ERROR: Cannot run compiler 'cl'. Maybe you forgot to setup the environment?
You'll need to have PostgreSQL installed so you have libpq.lib and libpq.dll. You cannot compile the Qt PostgreSQL driver without these. You'll also need to find the include directory for your PostgreSQL install, the one that contains libpq-fe.h.
Then determine the paths to those. Set the PATH to include the directory with libpq.dll. Set LIBS to include the directory with libpq.lib. And set the INCLUDEPATH to include the directory with libpq-fe.h.
You'll probably need to do this within a "Visual Studio Command Prompt" or run vcvarsall.bat fist, too, so qmake can find Visual Studio.

Stack cannot find libpq when given directory

I am trying to set up a stack project that uses the postgresql-simple package among others. When trying to stack build, all of the dependencies for postgresql-simple installed without issue, but stack is having trouble installing postgresql-simple itself. I get the following error:
C:project> stack build --extra-include-dirs="C:\PostgreSQL\8.4\include" --extra-lib-dirs="C:\PostgreSQL\8.4\lib"
... omitted ...
*****************
--extra-include-dirs=C:\PostgreSQL\8.4\include
*****************
--extra-include-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\include
--extra-include-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include
*****************
--extra-lib-dirs=C:\PostgreSQL\8.4\lib
*****************************
--extra-lib-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\lib
--extra-lib-dirs=C:\Users\User\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\User\Desktop\draftkings\NFAccuracy\.stack-work\logs\postgresql-libpq-0.9.1.1.log
Configuring postgresql-libpq-0.9.1.1...
Setup.hs: Missing dependency on a foreign library:
* Missing C library: pq
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
I've tried also specifying the paths in my stack.yaml file, same error.
I've tried manually copying the library and include files from my postgres installation to the mentioned ...\mingw64\lib and ...\mingw64\include folders. Same error.
I have the files libpq.dll and libpq.lib in my C:\PostgreSQL\8.4\lib folder.
I feel like I'm missing something obvious but I can't get this to work and I'm not sure what I'm doing wrong. Any help is appreciated.
Update
I forgot to mention two important details.
First, I have added C:\PostgreSQL\8.4\bin to my PATH. As far as I know, this works as expected, because I got past an error about pg_config missing, to the error I currently have.
Second, I also tried adding the lib and include directories to my PATH, but this did not change the error.
I should also mention my Postgres installation works fine on its own.
I know that the Snowdrift project uses PostgreSQL and builds with Stack on Windows. They have a build guide on their site. It looks like one difference is that they mention:
Add the PostgreSQL bin directory to the path C:\Program Files (x86)\PostgreSQL\9.4\bin
Can you try adding that to the PATH and see if that fixes it?
There was some kind of version mismatch.
Installing Postgres 9.4 instead of 8.4 allowed the postgresql-simple package to be built in the manner I was attempting.
My stack project, without intervention by me, defaulted to using resolver: 'lts-3.7' This provided version 0.4.10.0 of the postgresql-simple package to my project. I wish I had a more detailed answer, but all I can tell is that this version of postgresql-simple (which is fairly recent) works fine with PostgreSQL 9.4 (which is also recent).
And thankfully, using haskell and postgresql-simple built against Postgres 9.4 libraries is having no issue communicating with my 'remote' (virtualbox) database which is Postgres 8.4.
I'm tempted to flag my question as not constructive unless others find this useful info.

Installing plpythonu on Windows

I'm trying to install plpython on a postgres server on a Windows machine. When I issue the command CREATE EXTENSION plpython3u; in postgres, I get the following error, which I'm trying to find the source of.
ERROR: could not load library "C:/Program Files/PostgreSQL/9.3/lib/plpython3.dll": The specified module could not be found.
This file exists, which I presume means that Windows can't find one of the files it depends on. When I open the plpython3.dll with Dependency Walker, it tells me it can't locate the GPSVC.dll.
Is it likely that this missing dll would cause the CREATE EXTENSION command to fail? I found a .dll with the same name in C:\Windows\System32 and copied it over to C:\Windows\SysWOW64, but this did not resolve the probelm, and although dependency walker now finds the .dll, it raises several other errors about having modules with different CPU types.
I know this is an old question, but thought I would post to save someone the headaches I went through trying to fix this...
I had the same error trying to add pl python using Postgres 9.5. Dependency walker showed that plpython3.dll was looking for python33.dll, so I installed python 3.3 and added the install directory into my path and that seems to have fixed the problem.
Use specific python version on Windows. I could get it running with python 3.2.x with postgres 9.3

Problems installing/compiling DBD::mysql on OpenSuSE 10

I am getting a bunch of compile errors when I try to install the MySQL DBD::mysql Perl library. I am trying to install this library on OpenSuse linux (SUSE Linux Enterprise server 10 (x86_64) version 10, patch level 4)
The install fails when trying to compile dbdimp.h. There are hundreds of complile errors but I have reason to believe they all stem from the first 3:
dbdimp.h:23:49: error: mysql.h: No such file or directory
dbdimp.h:24:45: error: mysqld_error.h: No such file or directory
dbdimp.h:26:49: error: errmsg.h: No such file or directory
I believe that the reason I am getting the errors above is that I have no MySql Client installed. I do not know how to install mysql client (I believe I am supposed to get some version of libmysqlclient).
I am brand new to opensuse and vaguely familar with installing packages on Linux in general have used yum, yast, apt-get on ubuntu + centOS previously but the only package manager tools that seem to be on OpenSuse 10 are rpm and zypper. I have not managed to install the required mysql client using either of these. If anyone knows how to install MySql Client to resolve my issue I would greatly appreciate any recomendations
Thanks
You need to install MySQL or the MySQL client libraries, either through your system's package manager or by following the installation instructions from the source code.
It sounds like your question is really "How do I install MySQL on OpenSuse", which would be more appropriate for one of the other StackExchange sites.
I was able to resolve this to a point. In my original question, I stated that I had tried using YAST but that it had not worked. In fact, I did not fully explore the YAST install option but when I did, I managed to download install the required librarys by following an article I found (http://adminramble.com/install-mysql-yast/#chitika_close_button)
I was able to open the YAST GUI in the terminal window (not an X-window display) and navigate through the "software management" section wherein I was able to do a search for MySql. Amoung the search results were mysql client libraries, which I then selected and hit "Accept". The installation started and completed successully.
In order to complile the PERL DBD::mysql module, I had to create a new makefile with the ccflags specified so that the header files could be found:
perl Makefile.PL --cflags -I/usr/include/mysql
I say "to a point" at the top of this comment because I then ran into further problems compiling but my original issue posted has been partially resolved and getting this far may help someone else who is experiencing the same problem. Will update if I get a solution to the compile problem.

Zend CLI Tool issue - php: permission denied?

today i have recompiled PHP with PDO msql driver and now i cant use Zend CLI tool anymore.
Before Zend CLI tool was working fine, but now i get:
./zf.sh: 44: php: Permission denied
I am really out of ideas what is the problem here :/
i have tried changing permsissions, groups, google... but i didnt find any answers for this type of problem :/
Please help if you have any suggestion what should i do :)
Almost forgot:
Ubuntu, PHP 5.3 (as module) on apache 2.0
thanks for your time and reply!
Edit (PB): For those wondering, line 44
"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$#"
Why did you recompile php5? You can just compile the required PDO libs as well you know :p.
And AFAIK MSSQL is (or was at least) compatible with the Sybase DB drivers, so you could just as easily use these.
Check out Install PDO, PDO_SQLITE, PDO_DBLIB, PDO_MYSQL, it should work for Ubuntu too since it's Debian based.
BTW Just reinstall php5 that came with Ubuntu first, then follow the instructions there.
Hope it helps!