Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Friday, October 19, 2012

[SOLVED] Getting PostgreSQL 9.1.4 module for PHP-5.4.7 on Slackware 14

Slackware 14 by default carrying PHP-5.4.7 and running smooth well, BUT unfortunately it doesn't come with PostgreSQL, after searching for a while, i decided to install PostgreSQl from scratch.

PostgreSQL 9.1.4 :
SlackBuild : postgresql.tar.gz

Follow this step to compile and install PostgreSQL 9.1.4 on Slackware 14.0 :
1. cd /tmp
2. wget ftp://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.bz2
3. Extract SlackBuild script tar -zxvf postgresql-9.1.4.tar.gz
4. Go to Extracted directory cd postgresql-9.1.4
5. Run this command sh postgresql.SlackBuild /tmp/postgresql-9.1.4.tar.bz2
6. After all finish, it will create /tmp/postgresql-9.1.4-i486-1_SBo.tgz
7. Install it using installpkg postgresql-9.1.4-i486-1_SBo.tgz
8. Run this command su postgres -c "initdb -D /var/lib/pgsql/data"
9. Then run this /etc/rc.d/rc.postgresql start
10. Done

Now, the hard part ^^, actually after you find solution, you will said...Hhhmmm just like that hah :D, because PHP-5.4.7 inside Slackware 14 is not compiled using --with=pgsql option, and because i don't want to touch anything about PHP that i'm already set all option and some configuration running smothly on PHP-5.4.7, and also because my server is used for production. the point is, i just want to add pgsql.so into php.ini. That's it, nothing more.

And here is the solution.

PHP-5.4.7 :
SlackBuild : php-pgsql.tar.gz ( I Know this script for PHP-5.4.6, just relax okay ^^ )

Follow my step please :
1. cd /tmp
2. wget http://www.php.net/distributions/php-5.4.7.tar.bz2
3. wget http://slackbuilds.org/slackbuilds/14.0/libraries/php-pgsql.tar.gz
4. Extract SlackBuild script tar -zxvf php-pgsql.tar.gz
5. Go to extracted directory cd php-pgsql
6. Then mcedit php-pgsql.SlackBuild, and change version to correct one (5.4.7)
7. mcedit php-pgsql.info and change, change version and MD5SUM too.
8. Then run php-pgsql.SlackBuild /tmp/php-pgsql.tar.gz
9. After finish, you should get /tmp/php-pgsql-5.4.7-i486-1_SBo.tgz
10. Installpkg /tmp/php-pgsql-5.4.7-i486-1_SBo.tgz
11. Enable pgsql module by editing mcedit /etc/php/pgsql.ini and enable extension=pgsql.so by removing ;
12. Done

Proved :
root@slackware:~/Desktop# php -m | grep pgsql
If everything okay, you will get pgsql as result.

My info.php


Wednesday, December 14, 2011

Getting PostgreSQL 9.0.4 module for PHP-5.3.8 on Slackware 13.37

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!