PHP CLI Segmentation Fault With pgsql

So that I know of, PHP CLI in Ubuntu 8.10 is broken when you use the pgsql module in PHP. While I don't know the reason why exactly, I do know this has something to do with the curl module loading before pgsql. Whilst this issue hasn't been patched in PHP 5.2 nor in PostgreSQL 8.3 or 8.4 for that matter - there is an easy enough workaround in the mean time to get it working:

You should have a PHP conf directory located in /etc/php5/conf.d and in there are your modules that get loaded. Open up pgsql.ini and comment out the line that says 'extension=pgsql.so' by adding a '#' to the front of the line. This will stop PHP from loading the extension by loading this file. Next, we what to add the very line we commented out to the curl.ini file BEFORE the curl.so extension is loaded.

Once you've don that, CLI should work a treat, PHP through Apache will be unchanged.

Happy coding :)

thank you, thank you, thank

thank you, thank you, thank you, thank you :)

been puzzled as to why i could not run drush on my debian etch with postgres 8.3 for months. you trick did it :)

Same fault on debian lenny.

Same fault on debian lenny.

Same fault on debian

Same fault on debian lenny.

Another way to fix this is to do

mv /etc/php5/cli/pgsql.ini /etc/php5/cli/0-pgsql.ini

So nice comments, I try to

So nice comments, I try to add it in my brouse. Thank you

Sensational, this was doing

Sensational, this was doing my head in, good work!

Thanks!!!! I had the very

Thanks!!!! I had the very same issue and your fix works perfectly!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <h2><h3><h4><a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <div> <span>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: a, abbr, acronym, code, pre.
  • You may insert videos with [video:URL]

More information about formatting options