php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43823 Segmentation fault at end of script
Submitted: 2008-01-11 21:17 UTC Modified: 2008-01-20 01:00 UTC
Votes:18
Avg. Score:3.9 ± 0.8
Reproduced:15 of 15 (100.0%)
Same Version:3 (20.0%)
Same OS:5 (33.3%)
From: andreas dot meinl at gmx dot de Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.5 OS: Ubuntu 7.10, AMD64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-01-11 21:17 UTC] andreas dot meinl at gmx dot de
Description:
------------
When I use PDO to connect to my PostgreSQL database, I get a segmentation fault at the end of my PHP script.

Ubuntu 7.10, AMD64, PHP 5.2.3, PostgreSQL 8.2.5

Reproduce code:
---------------
<?php

$hostname = 'localhost';
$dbname = 'xxx';
$username = 'xxx';
$password = 'xxx';

$db = new PDO('pgsql:host=' . $hostname . ';dbname=' . $dbname, $username, $password);

?>

Expected result:
----------------
I expect nothing, no single line of text.

Actual result:
--------------
am@localhost:/tmp$ php ./test.php
Segmentation fault (core dumped)
am@localhost:/tmp$

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-14 03:39 UTC] jfolkins at gmail dot com
Description:

I wanted to add a piece to this puzzle that may be helpful. Though I am not using PDO, I am using pg_connect() to connect to my PostgreSQL database.

Machines: 
----------------------------
1) Dell p4 3.2gz 1gb RAM, Ubuntu 7.10 x86, PHP 5.2.3, PostgreSQL 8.2.5

2) AMD64 X2 3800+ 1GB RAM, Ubuntu 7.10 x86, PHP 5.2.3, PostgreSQL 8.2.5

Script:
----------------------------
<?php

$host   = "localhost";
$port   = "xxx";
$dbname = "xxx";
$user   = "xxx";
$pass   = "xxx";

$dbtest = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$pass");

if (!$dbtest) { 
echo "Connection Failed\n";
pg_close($dbctest);
} else { 
echo "Connection Successful\n";
pg_close($dbtest);
} 
echo phpversion()."\n";

?>
Expected Results:
----------------------------

I expect the word "Successful" to be displayed along with the version number of php on this machine.

Results:
----------------------------

xxx@xxx:/dial/app/db$ php db_test.php
Connection Successful
5.2.3-1ubuntu6.2
Segmentation fault (core dumped)
xxx@xxx:/dial/app/db$ 

Additional Notes:
----------------------------

I get the same results on both machines.

I also wanted to add that I have scripts that input data into the database. These sciprts DO indeed work. But, I always get the "Segmentation fault (core dumped)" at the end of every script that connects to the postgreSQL database.
 [2008-01-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-08-10 00:34 UTC] rod at 23net dot net
I am experiencing this same problem.  It happens on some systems but not others (all configured exactly the same).

Some systems are 32 bit, some 64 bit, all running FreeBSD 7.0 (either i386 or AMD64), PHP 5.2.6 and Postgres 8.3.3.

The segfault ALWAYS occurs at the end of the script even when the connection is explicitly closed. The script performs as expected, it just segfaults when the script ends. It happens when using PDO or pg_connect().
 [2008-08-10 00:57 UTC] rod at 23net dot net
I was mistaken.  The systems were NOT configured the same.  This is a known issue with the order of extensions listed in extensions.ini in FreeBSD. Reordering the extensions fixed the problem.
 [2009-04-08 03:35 UTC] mpoisson at livra dot com
I'm having the same problem on 3 diferent Linux distributions Ubuntu, Debian and Centos. The last one is a 64bits OS.

On Ubuntu and Debian it was solved changing the order of the extensions on the ini files. In my case I had to load Postgres extension before CURL.

Under CentOS I'm still trying to solve it.
 [2009-05-08 20:14 UTC] delgado dot enrique at gmail dot com
I had to comment out:

extension=curl.so

From /etc/php5/cli/conf.d/curl.ini 

And add it to /etc/php5/cli/conf.d/pgsql.ini AFTER:

extension=pgsql.so

To get around this issue.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 10:01:25 2019 UTC