I wanted to play around with PostgreSQL on the test server at work today, and found the slackpack over at LinuxPackages. I was very pleased that I wouldn’t have to compile PostgreSQL from source, as such complex apps will take more time than I would like to invest.
Anyway, once I’ve installed the package, and initialised the database, I decided to give phpPgAdmin a whirl on my freshly baked PostgreSQL installation, but when I try to use it I get an error message telling me that I have not compiled proper database support into my PHP installation.
I checked out my
phpinfo();
and sure enough, Slackware‘s package was not built with the --with-pgsql
option.
Most of my googling results mention that the only solution is to recompile PHP from scratch, including the
--with-pgsql
flag. Hmm, I'm really hate to replace my original PHP installation which was done in the “proper” way, ie. via the available slackpack. Who know what the hell I can possibly misconfigure and break!- Download the PHP source code (be sure to use the PHP version that’s the same with your installation).
- Unpack the archive and go to the source directory (well, duh!).
- Run
./configure ---with-pgsql=shared,/usr
(I know it’s too short, but just trust me on this, OK). - Run
make
. - Don’t run
make install
orcheckinstall
(if you’re using checkinstall, that is) like you usually would. - Just copy /modules/pgsql.so to /usr/lib/php/extensions.
- As root, edit your /etc/apache/php.ini file and look for a line saying extension=mysql.so
- Under this line type in: extension=pgsql.so and save the file.
- Restart your apache service by running /etc/rc.d/rc.httpd restart (again, as root) to activate PostgreSQL support in PHP.
Hope this helps other Slackers as well as Linux users in general.
In short
You need only the PHP pgsql.so module, verify with pkgtool what's your PHP version, mine is 5.3.8 (Slackware 13.37). Download in /usr/local/src the PHP sources, I take them from php.net website using this link
You need only the PHP pgsql.so module, verify with pkgtool what's your PHP version, mine is 5.3.8 (Slackware 13.37). Download in /usr/local/src the PHP sources, I take them from php.net website using this link
http://www.php.net/get/php-5.3.8.tar.bz2/from/a/mirror
replacing the version number
http://www.php.net/get/.tar.bz2/from/a/mirror
Extract the compressed tarball, dive into the newly created directory and as article say type :
./configure --with-pgsql=shared,/usr
thenmake
Now copy the module in the corrected directory
#cp -v modules/pgsql.so /usr/lib/php/extensions/
Open with an editor /etc/httpd/php.ini
extension=pgsql.so
#mcedit /etc/https/php.ini
and add this line
extension=pgsql.so
Restart apache
#/etc/rc.d/rc.httpd restart
Done
you can download my PostgreSQL 9.0.4 module for PHP-5.3.8 on Slackware 13.37 HERE
Referensi : Referensi 01 Referensi 02
Referensi : Referensi 01 Referensi 02
7 comments:
Did the same on Slackware 14.0, and the newly generated and copied pgsql.so module does not work. When I do php -m, it does not appear (although pdo_pgsql.so does). When I run a PHP app referencing pg_connect(), I get this:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/pgsql.so' - /usr/lib/ph
p/extensions/pgsql.so: undefined symbol: executor_globals in Unknown on line 0
Any help would be appreciated.
To clarify, php -m lists "pdo_pgsql" but not "pgsql". php -i lists:
PDO drivers => pgsql, sqlite
but says nothing else about pgsql.
I don't have Slackware 14, i will download it today, and see if i can help you.
Here the solution http://diantokam.blogspot.com/2012/10/solved-getting-postgresql-914-module.html
Got the same PHP Warning as jefnik mentioned.
I need pdo_pgsql.so to be installed on Slackware 14.
Is there any Slackbuild for this?
Any help would be welcome.
Here's my PostgreSQL 9.1.4 modul
http://www.mediafire.com/download.php?e2wbaedagyv4xtb.
Or you can see my instruction that i gived to jefnik
http://diantokam.blogspot.com/2012/10/solved-getting-postgresql-914-module.html
Good reading yourr post
Post a Comment