define('DISABLE_WP_CRON', 'true'); Getting Additional PHP Modules Without (Totally) Recompiling - HTNet

Getting Additional PHP Modules Without (Totally) Recompiling

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.

Bargh, I checked out my phpinfo(); and sure enough, Slackware‘s package was not built with the --with-pgsql option.

Most of my googling results metion that the only solution is to recompile PHP from scratch, including the --with-pgsql flag. Hmm, I’d 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!

Anyway, here’s how I got my PostgreSQL to work with the default Slackware PHP installation:

  1. Download the PHP source code (be sure to use the PHP version that’s the same with your installation).
  2. Unpack the archive and go to the source directory (well, duh!).
  3. Run ./configure ---with-pgsql=shared,/usr (I know it’s too short, but just trust me on this, OK).
  4. Run make.
  5. Don’t run make install or checkinstall (if you’re using checkinstall, that is) like you usually would.
  6. Just copy <php source dir>/modules/ to /usr/lib/php/extensions.
  7. As root, edit your /etc/apache/php.ini file and look for a line saying
  8. Under this line type in: and save the file.
  9. 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.

16 responses to “Getting Additional PHP Modules Without (Totally) Recompiling”.

  1. Abd Elrahman Ghareeb Says:

    Thanks alot man you really saved me some time 🙂

  2. Site Admin Azmeen Says:

    Glad the tip helped you 🙂

  3. Logan Says:

    Wouldn’t it be cleaner and just as simple to get the Slackware source for the php package, then modify the php.SlackBuild script to add the one option? Then you would get a package you could install using “installpkg” that would have PHP exactly as Slack has it by default but with only one option different.

  4. Site Admin Azmeen Says:

    Just to get one measly library?

    In one word; no.

  5. martos Says:


  6. Steve Says:

    yep nice tip, Can-it pro owe you cos i wasnt gonna recompile

  7. vizzz Says:

    it works but, when i cant connect and pg_last_error returs a void string.
    host,pass,pass and db are ok.
    any hint?

  8. Site Admin Azmeen Says:


    That’s more of a connection issue rather than the module.

  9. Alessandro Pastore Says:

    Many thanks

  10. Michał Roszka Says:

    Thank you very much for sharing this time-saving hint.

  11. Dan Roberts Says:

    I had exactly the same issue trying to run phpPgadmin!! Thanks for this, it works like a champ while retaining the correct slack package configuration.

  12. Nik Says:

    Azmeen, THAAAANK YOU!! After all the problems I met and solved installing Postgresql I was stuck because the PHP installed in my Plesk box was compiled … without Postgresql support and I didn’t want to install PHP from scratch risking to compromise the whole box. So I can confirm your solution works also on CentOS.
    Thank you again, now I can conclude my day with a smile upon my face.

  13. Site Admin Azmeen Says:

    No problem Nik. Glad the article helped you 🙂

  14. Mulatinho Says:

    Thanks, from Brazil.

    Nice tip!

  15. Getting PostgreSQL 9.0.4 module for PHP-5.3.8 on Slackware 13.37 « Just Me & My Computer Says:

    […] Source : […]

  16. ABC Says:

    Azmeen, thank you very much for this great how-to!
    Saved me a lot of time and effort. Will bookmark your site for sure!