ID: 31038 Updated by: [EMAIL PROTECTED] Reported By: damien dot harper at keops dot net -Status: Open +Status: Feedback Bug Type: OCI8 related Operating System: Red Hat 8 PHP Version: 4.3.10RC2 New Comment:
This is pure guess, but in file ext/oci8/oci8.c try changing the number 2 on line 2180 to 0 (zero) and recompile PHP. Patch here: Index: oci8.c =================================================================== RCS file: /repository/php-src/ext/oci8/oci8.c,v retrieving revision 1.183.2.16 diff -u -r1.183.2.16 oci8.c --- oci8.c 3 Nov 2004 13:35:56 -0000 1.183.2.16 +++ oci8.c 13 Dec 2004 23:02:12 -0000 @@ -2177,7 +2177,7 @@ /* Safe, charsetid is initialized to 0 */ CALL_OCI(OCINlsEnvironmentVariableGet(&charsetid, - 2, + 0, OCI_NLS_CHARSET_ID, 0, &rsize)); Previous Comments: ------------------------------------------------------------------------ [2004-12-13 10:18:11] damien dot harper at keops dot net I tried several ways to set the environnement variables up : 1. within /etc/profile (export VARIABLE=value) 2. within apache start script (/usr/local/apache2/bin/apachectl) 3. within the PHP script using PHP's putenv function All these ones are set : ORACLE_HOME ORACLE_SID LD_PRELOAD LD_LIBRARY_PATH NLS_LANG ORA_NLS33 Still crashing... ------------------------------------------------------------------------ [2004-12-11 14:42:34] [EMAIL PROTECTED] Please check that you have properly setup the Oracle environment variables as mentioned here: http://www.php.net/manual/en/ref.oci8.php (check the user comments about setting it up!) ------------------------------------------------------------------------ [2004-12-09 16:01:34] damien dot harper at keops dot net Description: ------------ Apache crashes (segmentation fault) as soon as it encounters the ocilogon instruction. Everything works like a charm from command line! sqlplus connects and queries without any errors. For information : Apache 2.0.52 compiled and installed with : ./configure -–enable-shared=max make make install PHP 4.3.10RC2 (same problem with PHP 4.3.9) compiled and installed with : ./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --prefix=/usr --with-config-file-path=/etc --disable-debug --enable-pic --enable-inline-optimization --with-curl --with-dom=/usr --with-exec-dir=/usr/bin --with-gettext --with-ncurses --with-regex=system --with-xml --with-expat-dir=/usr --with-zlib --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-track-vars --enable-trans-sid --with-pear=/usr/share/pear --with-mysql=shared --with-oci8=shared --enable-bcmath --with-apxs2=/usr/local/apache2/bin/apxs make make install Oracle Client 9.2.0.1 (same problem with 9.2.0.2 and 9.2.0.3) Oracle database is 8.1.6 (same problem with our test database which is Oracle 9i) Reproduce code: --------------- $username = "*****"; $passwd = "*****"; $host = "10.211.162.35"; $port = "1521"; $service = "SIRENET"; $db="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port)))(CONNECT_DATA=(SERVICE_NAME=$service)))"; $conn = OCILogon($username,$passwd,$db); if (!$conn) { echo "Connection failed"; echo "Error Message: [" . OCIError($conn) . "]"; exit; } else { echo "Connected!"."\n"; $parse=OCIParse($conn,"select che_nocheval from cheval where rownum < 10"); // OCIDefineByName($parse,"che_nocheval",$che_nocheval); OCIExecute($parse,OCI_DEFAULT); echo "\nRecuperation de donnees\n"; $nrows = ocifetchstatement($parse, $rs, 0, 100,OCI_NUM); $resultTab = ""; $numCol = 0; for ( $iRow = 0; $iRow < $nrows; $iRow++ ) { reset($rs); while ( $column = each($rs) ) { $data = $column['value']; $resultTab[$iRow][$numCol] = $data[$iRow]; echo $iRow.'|'.$numCol.'|'.$resultTab[$iRow][$numCol]; $numCol++; } $numCol = 0; } OCIFreeStatement($parse); OCILogoff($conn); } Actual result: -------------- Apache segfaults Starting program: /usr/local/apache2/bin/httpd -X [New Thread 8192 (LWP 2417)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 8192 (LWP 2417)] 0x4078fd5d in lxhcsn () from /home/oracle/OraHome1/lib/libclntsh.so.9.0 (gdb) bt #0 0x4078fd5d in lxhcsn () from /home/oracle/OraHome1/lib/libclntsh.so.9.0 #1 0x40274837 in kpcsnevget () from /home/oracle/OraHome1/lib/libclntsh.so.9.0 #2 0x401ecae2 in OCINlsEnvironmentVariableGet () from /home/oracle/OraHome1/lib/libclntsh.so.9.0 #3 0x4113eb53 in _oci_open_session (server=0x8224cb8, username=0x821735c "sirenet", password=0x82174ec "sirenet", persistent=0, exclusive=0, charset=0x4114595d "") at /root/kic_temp/php-4.3.9/ext/oci8/oci8.c:2183 #4 0x4113f9e6 in oci_do_connect (ht=3, return_value=0x82176d4, this_ptr=0x0, return_value_used=1, persistent=0, exclusive=0) at /root/kic_temp/php-4.3.9/ext/oci8/oci8.c:2715 #5 0x41142d83 in zif_ocilogon (ht=3, return_value=0x82176d4, this_ptr=0x0, return_value_used=1) at /root/kic_temp/php-4.3.9/ext/oci8/oci8.c:4340 #6 0x40c8e866 in execute (op_array=0x8212914) at /root/kic_temp/php-4.3.9/Zend/zend_execute.c:1640 #7 0x40c81ea3 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/kic_temp/php-4.3.9/Zend/zend.c:891 #8 0x40c5c563 in php_execute_script (primary_file=0xbffff6d0) at /root/kic_temp/php-4.3.9/main/main.c:1735 #9 0x40c9315a in php_handler (r=0x820a698) at /root/kic_temp/php-4.3.9/sapi/apache2handler/sapi_apache2.c:540 #10 0x0807c902 in ap_run_handler (r=0x820a698) at config.c:152 #11 0x0807ce1a in ap_invoke_handler (r=0x820a698) at config.c:363 #12 0x0806c5d3 in ap_process_request (r=0x820a698) at http_request.c:246 #13 0x080686ad in ap_process_http_connection (c=0x82064b8) at http_core.c:250 #14 0x08085ba6 in ap_run_process_connection (c=0x82064b8) at connection.c:42 #15 0x0807b47b in child_main (child_num_arg=0) at prefork.c:609 #16 0x0807b626 in make_child (s=0x80ba0c8, slot=0) at prefork.c:649 #17 0x0807b67f in startup_children (number_to_start=8) at prefork.c:721 #18 0x0807bd8d in ap_mpm_run (_pconf=0x807ae44, plog=0x80eda70, s=0x80ba0c8) at prefork.c:940 #19 0x08080d42 in main (argc=2, argv=0xbffffa24) at main.c:617 #20 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 (gdb) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31038&edit=1