php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36880 OciLogon crashes apache
Submitted: 2006-03-28 00:05 UTC Modified: 2006-04-04 08:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jbond007 at atsat dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.1.2 OS: Linux RH4
Private report: No CVE-ID: None
 [2006-03-28 00:05 UTC] jbond007 at atsat dot com
Description:
------------
I installed php 5.1.2 working with Apache 2.2
(the problem occurs with Apache 1.X.Y too and with 
 php4.X too).

When I ask <?phpinfo()?> everything appears correctly,
ORACLE_HOME, LD_LIBRARY_PATH and other env vars 
are correct.
But OciLogon crashes apache with a segmentation Fault,
each time I use it.
If I use Ocilogon with php in cgi mode, it works fine,
and I could connect to my database, but not with apache.



Reproduce code:
---------------
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-openssl --with-bz2 --with-mysql=/usr/local/mysql --enable-ftp --with-oci8=/oraclebase/u01/app/oracle/product/10.2.0 --enable-bcmath --enable-calendar --enable-sigchild --with-pdo-oci=/oraclebase/u01/app/oracle/product/10.2.0

The script to start apache is:

ORACLE_BASE=/oraclebase/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
/usr/local/apache/bin/apachectl start


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-28 00:06 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-03-28 12:11 UTC] jbond007 at atsat dot com
I get the same behaviour with the version 5.1.3RC
Then, in Ocilogon($user,$pass,$db),
using the complete string found in tnsnames.ora,
instead of the short name, makes it work randomly
but not often. Then, sometimes instead of a segmentation
fault, I get : OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /usr/local/web/sfmi/include/oraconnect.php on line 38

And if I use Ocilogon($user,$pass,$db,$charset), with
$charset='WE8DEC', I always get a segmentation fault.

A check of getenv('ORACLE_HOME') before calling
ocilogon, shows $ORACLE_HOME env var is correct.
 [2006-03-28 12:27 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Definitely not reproducible here.
 [2006-03-28 15:28 UTC] jbond007 at atsat dot com
Seems such problems don't happen only in ocilogon,
here are 2 backtraces I generated from gdb as I didn't
get any core:

Backtrace calling OCIlogon:

(gdb) bt
#0  0x01bc92e8 in lxhcsn ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#1  0x0146bcd2 in kpcsnevget ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#2  0x013f12ba in OCINlsEnvironmentVariableGet ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#3  0x00e9fed2 in php_oci_do_connect_ex (username=0x952e77c "boutique",
    username_len=8, password=0x952e854 "xxxxxx99", password_len=8,
    new_password=0x0, new_password_len=0,
    dbname=0x955650c " (DESCRIPTION =\n    (ADDRESS_LIST =\n      (ADDRESS = (PROTOCOL = TCP)(HOST = 128.128.2.1)(PORT = 1521))\n    )\n    (CONNECT_DATA =\n      (SID = OSID1)\n      (SERVER = DEDICATED)\n    )\n  )", dbname_len=186,
    charset=0x0, session_mode=0, persistent=0, exclusive=1)
    at /root/php5.1-200603280830/ext/oci8/oci8.c:993
#4  0x00ea0394 in php_oci_do_connect (ht=3, return_value=0x925ac2c,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=0,
    exclusive=1) at /root/php5.1-200603280830/ext/oci8/oci8.c:940
#5  0x00ea908e in zif_oci_new_connect (ht=3, return_value=0x925ac2c,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /root/php5.1-200603280830/ext/oci8/oci8_interface.c:1520
#6  0x0101ffb5 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff9d5c0)
    at zend_vm_execute.h:200
#7  0x0101f921 in execute (op_array=0x9262bb0) at zend_vm_execute.h:92
---Type <return> to continue, or q <return> to quit---Quit
(gdb) bt
#0  0x01bc92e8 in lxhcsn ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#1  0x0146bcd2 in kpcsnevget ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#2  0x013f12ba in OCINlsEnvironmentVariableGet ()
   from /oraclebase/u01/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
#3  0x00e9fed2 in php_oci_do_connect_ex (username=0x952e77c "boutique",
    username_len=8, password=0x952e854 "taipei99", password_len=8,
    new_password=0x0, new_password_len=0,
    dbname=0x955650c " (DESCRIPTION =\n    (ADDRESS_LIST =\n      (ADDRESS = (PROTOCOL = TCP)(HOST = 128.128.2.1)(PORT = 1521))\n    )\n    (CONNECT_DATA =\n      (SID = OSID1)\n      (SERVER = DEDICATED)\n    )\n  )", dbname_len=186,
    charset=0x0, session_mode=0, persistent=0, exclusive=1)
    at /root/php5.1-200603280830/ext/oci8/oci8.c:993
#4  0x00ea0394 in php_oci_do_connect (ht=3, return_value=0x925ac2c,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=0,
    exclusive=1) at /root/php5.1-200603280830/ext/oci8/oci8.c:940
#5  0x00ea908e in zif_oci_new_connect (ht=3, return_value=0x925ac2c,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /root/php5.1-200603280830/ext/oci8/oci8_interface.c:1520
#6  0x0101ffb5 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff9d5c0)
    at zend_vm_execute.h:200
#7  0x0101f921 in execute (op_array=0x9262bb0) at zend_vm_execute.h:92
---Type <return> to continue, or q <return> to quit---
#8  0x0101fb75 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff9e580)
    at zend_vm_execute.h:234
#9  0x0101f921 in execute (op_array=0x94a8f74) at zend_vm_execute.h:92
#10 0x010058fe in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /root/php5.1-200603280830/Zend/zend.c:1109
#11 0x00fccebc in php_execute_script (primary_file=0xbffa08d0)
    at /root/php5.1-200603280830/main/main.c:1726
#12 0x0108b4a3 in php_handler (r=0x923bd18)
    at /root/php5.1-200603280830/sapi/apache2handler/sapi_apache2.c:586
#13 0x0807172e in ap_run_handler (r=0x923bd18) at config.c:157
#14 0x08071af9 in ap_invoke_handler (r=0x923bd18) at config.c:371
#15 0x08085a89 in ap_process_request (r=0x923bd18) at http_request.c:258
#16 0x08083761 in ap_process_http_connection (c=0x9224800) at http_core.c:171
#17 0x08076da6 in ap_run_process_connection (c=0x9224800) at connection.c:43
#18 0x08096177 in child_main (child_num_arg=0) at prefork.c:640
#19 0x08096340 in make_child (s=0x2, slot=0) at prefork.c:680
#20 0x08096893 in ap_mpm_run (_pconf=0xbffa0c40, plog=0x90db198, s=0xbffa0c44)
    at prefork.c:956
#21 0x08061d4c in main (argc=2, argv=0xbffa0df4) at main.c:712

Backtrace without OCILogon:

[Switching to Thread -1208052032 (LWP 8008)]
0x00a067a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0x00a067a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00addfcb in writev () from /lib/tls/libc.so.6
#2  0x0015e608 in apr_socket_sendv (sock=0x865a668, vec=0xbfef2ad0, nvec=1,
    len=0xbfef0988) at network_io/unix/sendrecv.c:201
#3  0x0807034a in writev_it_all (s=0x865a668, vec=0xbfef2ad0, nvec=1, len=196,
    nbytes=0xbfef0a08) at core_filters.c:321
#4  0x08070e06 in ap_core_output_filter (f=0x865acb0, b=0x868c110)
    at core_filters.c:868
#5  0x080859b9 in ap_process_request (r=0x865e9d0) at http_request.c:231
#6  0x08083761 in ap_process_http_connection (c=0x865a800) at http_core.c:171
#7  0x08076da6 in ap_run_process_connection (c=0x865a800) at connection.c:43
#8  0x08096177 in child_main (child_num_arg=-32) at prefork.c:640
#9  0x08096340 in make_child (s=0x2, slot=0) at prefork.c:680
#10 0x08096893 in ap_mpm_run (_pconf=0xbfef2d70, plog=0x8511198, s=0xbfef2d74)
    at prefork.c:956
#11 0x08061d4c in main (argc=2, argv=0xbfef2f24) at main.c:712

Many thanks
 [2006-03-28 15:35 UTC] tony2001@php.net
And what if you try to set appropriate value for NLS_LANG env variable?
 [2006-03-28 16:16 UTC] jbond007 at atsat dot com
If I setup NLS_LANG=french_france.WE8DEC env var,
it always crashes, even never work randomly.
it's like if I use ocilogon with $charset parameter
with WE8DEC.
 [2006-03-28 16:24 UTC] tony2001@php.net
What MPM do you use with Apache2 ?
Are you able to reproduce it using PHP CLI ?
 [2006-03-28 16:44 UTC] jbond007 at atsat dot com
with apache2 I use --with_mpm=prefork
This problem occurs only with apache 2, or apache 1.XX.
In php cli it works fine.
 [2006-03-29 11:56 UTC] jbond007 at atsat dot com
I said OS=Linux RH4, but in fact it's Linux RHEL4.
Are there any version of php made for this version
of Linux? 
Kernels on this version are not standard as they 
could work with more than 4GO memory.
 [2006-03-29 12:04 UTC] tony2001@php.net
I've tested it on RHEL as well and I'm sure this issue is not reproducible,
You can also try Instant Client, which doesn't require any environment vairables, but in any case I'm afraid you're on your own with your problem.
 [2006-03-29 14:58 UTC] jbond007 at atsat dot com
I think I needn't test it with Instant client, as the
segmentation fault could happen randomly and without
using Oracle.
It even happened without I click on anything on my
php page.
 [2006-03-29 15:05 UTC] tony2001@php.net
>It even happened without I click on anything on my php page.
Apparently this means that it's not PHP problem.
 [2006-03-31 15:35 UTC] jbond007 at atsat dot com
When it occurs when it happens without I click on anything on my php page, it's only when php is compiled with
debug activated.
 [2006-03-31 15:56 UTC] tony2001@php.net
Still can't reproduce it.
Please check that you're able to run and use other Oracle applications.
 [2006-03-31 16:03 UTC] jbond007 at atsat dot com
I could install oracle 10.2g normally, even could apply 
the patch 10.2.0.2 with no problem.
I configured the whole database.
Even Import production data from my old server.
Could use configuration tools to connect and configure 
the database.
Could run a little php script in CLI mode 
which could connect to Oracle.

Fails only when we have Apache+Php,

Apache Any version (1.XX or 2.XX) and Php Any version
(4 or 5).
 [2006-04-04 08:11 UTC] jbond007 at atsat dot com
On OCI8 documentation, the ORA_NLS33 seems to be optional.
But it's not.
A correct value for this env var resolved my problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC