|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24740 Segmentation fault
Submitted: 2003-07-21 11:54 UTC Modified: 2003-08-26 00:57 UTC
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: rarteaga at icaro dot com dot ec Assigned:
Status: No Feedback Package: OCI8 related
PHP Version: 4.3.3RC2-dev OS: Linux RH9 and RH7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rarteaga at icaro dot com dot ec
New email:
PHP Version: OS:


 [2003-07-21 11:54 UTC] rarteaga at icaro dot com dot ec
Hi, I've installed Linux RH 9.0 and Oracle 9i, I'm trying to access the database from a php script, I make de connection and make a simple select like this:


And I get the information just fine with the oci functions (OCILogon, OCIParse, OCIExecute, etc...). Now I get a segmentation fault when I try to retrieve information of fields that are string or characteres, something like this:


The script crashes and dies saying "segmentation fault"

I'm connecting to the database as user "SCOTT" and getting information from table  EMP.

I can connect from an aplication I've developed in VB60 from a remote aplication server I have... but PHP is crashing...

Best Regards

Reproduce code:
#!/usr/bin/php -q
$username = "SCOTT";
$passwd = "TIGER";
$conn = OCILogon($username,$passwd,$db);
if (!$conn) {
   echo "Connection failed";
   echo "Error Message: [" . OCIError($conn) . "]";
else {
  echo "Connected!"."\n";
  $parse = OCIParse($conn,"select JOB from EMP");
  echo "\nRecuperacion de datos\n";
  while (OCIFetchinto ($parse, $row, OCI_ASSOC)) {
    echo $job;
        echo "\n";

Expected result:
I expect to see de job titles..

Actual result:
[root@oralinux htdocs]# ./oracle.php
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-21 11:58 UTC] rarteaga at icaro dot com dot ec
I'm sorry I made a mistake on the line


The correct value  must be JOB, it will be like this:


Still doesn't work..

 [2003-07-22 10:33 UTC]
Please try using this CVS snapshot:
For Windows:

AFAIK, this is fixed already.

 [2003-07-22 11:59 UTC] rarteaga at icaro dot com dot ec
Still not working, I downloaded and run the script with the CVS snapshot:

The backtrace I get:

Starting program: /usr/bin/php oracle.php
[New Thread 1084011968 (LWP 12585)]
Content-type: text/html
X-Powered-By: PHP/4.3.3RC2-dev


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1084011968 (LWP 12585)]
0x4207bfea in memcpy () from /lib/tls/
(gdb) bt
#0  0x4207bfea in memcpy () from /lib/tls/
#1  0x40406a13 in nioqrc () from /opt/oracle/product/9.2.0/lib/
#2  0x40538395 in ttcdrv () from /opt/oracle/product/9.2.0/lib/
#3  0x4040d1a8 in nioqwa () from /opt/oracle/product/9.2.0/lib/
#4  0x40261330 in upirtrc () from /opt/oracle/product/9.2.0/lib/
#5  0x4022393a in kpurcsc () from /opt/oracle/product/9.2.0/lib/
#6  0x401e6124 in kpuexecv8 () from /opt/oracle/product/9.2.0/lib/
#7  0x401e7cf7 in kpuexec () from /opt/oracle/product/9.2.0/lib/
#8  0x4024598f in OCIStmtExecute () from /opt/oracle/product/9.2.0/lib/
#9  0x08083efd in oci_execute (statement=0x822c014, func=0x817d0d6 "OCIExecute", mode=32)
    at /usr/local/php4-STABLE-200307221530/ext/oci8/oci8.c:1491
#10 0x0808a1c0 in zif_ociexecute (ht=1, return_value=0x822bf94, this_ptr=0x0, return_value_used=0)
    at /usr/local/php4-STABLE-200307221530/ext/oci8/oci8.c:3972
#11 0x0816fbc7 in execute (op_array=0x81ff58c) at /usr/local/php4-STABLE-200307221530/Zend/zend_execute.c:1616
#12 0x08160182 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/local/php4-STABLE-200307221530/Zend/zend.c:885
#13 0x08130aec in php_execute_script (primary_file=0xbfffdc90) at /usr/local/php4-STABLE-200307221530/main/main.c:1685
#14 0x08175ead in main (argc=2, argv=0xbfffdd34) at /usr/local/php4-STABLE-200307221530/sapi/cgi/cgi_main.c:1542
#15 0x42015504 in __libc_start_main () from /lib/tls/
 [2003-08-13 21:46 UTC]
Have you set the relevant environment variables in the shell before you run the script? (setting them inside the script does not work)

 [2003-08-20 14:47 UTC] rarteaga at icaro dot com dot ec
Yes I've setted the relevant configuration variables. Among others I have the most important one:


I've tryed others about language, TNS NAMES, etc... None of them solved the problem, As I said is working fine until you try to make a SELECT in witch you have to get information from a varchar2() fields on the table...

I've stopped using OCI8 extension for the moment, instead I'm using the oracle extension (ora_Logon, ora_Execute, etc.) and its working fine, I solved my problem so far. However OCI8 has a lot more special functions I'm interested on using...

 [2003-08-20 17:49 UTC]
The environment variables has to be set in the shell prior to starting your webserver. Setting them in a script has no effect whatsoever.

 [2003-08-20 18:09 UTC] rarteaga at icaro dot com dot ec
As you can see in the detail of this bug report, I'm not running the script from a webserver, that's why I put:

#!/usr/bin/php -q

to run it from the console like this:


I get the result in the standar output.

Setting the relevant configuration variables in the script do work, if I do not put this line for example:


The script will simple tell me that ORACLE is not present and so on.

I understand that once the script works fine, I'll have to put the correct env. variables so Apache knows ORACLE its present, mean while putenv works just fine...
 [2003-08-20 23:52 UTC]
What was the configure line used to configure PHP?

 [2003-08-26 00:57 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2003-09-30 13:04 UTC] goahead at enkai dot co dot kr
while (OCIFetchinto ($parse, $row, OCI_ASSOC)) {

--> while (OCIFetchinto ($parse, &$row, OCI_ASSOC)) {
 [2005-05-31 21:23 UTC] mjohnston at planetactive dot com
We also experience a similar bug in all CLI scripts 
which use oci to talk to oracle. So far, the scripts all 
function as expected, but seg fault on exiting.

one group of servers is running php 4.3.8, the other 
4.1.2. Oracle is

Linux is Redhat 9
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 20:05:44 2022 UTC