[PHP-DB] Re: [External] : [PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication
On 28/9/21 6:59 pm, Mathias Zarick wrote: Hi there, I am wondering how it would be possible to use authentication using a secure external password store aka wallet with PDO OCI. See Oracle external authentication and OCI_CRED_EXT in the underground php oracle manual. and https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-authentication.html#GUID-803496D2-19C7-4F02-94EC-C13EDD8FB17B (jump to chapter 3.2.9) Following works fine with oci8: $conn = oci_connect('/', '', $db, 'UTF8',OCI_CRED_EXT); note the OCI_CRED_EXT! But how can pass that option to a PDO OCI connection? Following might be close, but does not work: $opt = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_NUM, 'session_mode' => OCI_CRED_EXT, ]; try{ $conn = new PDO("oci:dbname=".$db.';charset=UTF8', "/","", $opt); } catch(PDOException $e){ echo ($e->getMessage()); } Is it possible at all? You can see in the PDO_OCI source code there is no reference to the OCI_CRED_EXT constant which is needed to tell the Oracle client libraries to use external authentication. PR's are welcome. For the moment stick with OCI8. In general, native drivers (e.g OCI8) will be better than any of the PDO abstractions. Chris Thanks in Advance Mathias Zarick -- https://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Getting PDO-OCI to work in PHP 7
Possibly try a two stage build: - build your main PHP without PDO_OCI - build PDO_OCI as a shared library with a simplified configure command that doesn't have ldap. Then move the resulting PDO_OCI library to your first PHP install and update php.ini. Then test thoroughly. I have had to do the same with PHP OCI8 in the past. I don't recall trying it with PDO_OCI. The ldap / Oracle Client header clash isn't new in PHP 7. Chris On 29/5/19 6:31 am, Stokes, John M via php-db wrote: I have made multiple attempts to get PDO-OCI to work in PHP 7. Sometimes it fails to compile at all, other times appears to compile correctly, but I can't connect to any Oracle databases. Thus far, this has kept me stuck on PHP 5.x. The relevant part of my configure statement is: ./configure \ ... --with-mysqli=/usr/bin/mysql_config \ --with-pdo-mysql=/usr \ --with-pdo-odbc=unixODBC,/usr \ --with-pdo-oci=instantclient,/usr/lib/oracle/18.3/client64/lib/ \ --with-unixODBC=/usr \ ... The latest error is when I run "make": ...snip... In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:30:0, from main/internal_functions.c:50: /usr/include/oracle/18.3/client64/ldap.h:988:18: error: conflicting types for ‘ber_scanf’ LDAPFUNCDECL int ber_scanf ( BerElement *ber, char * fmt, ... ); ^ In file included from /root/php-7.2.4/ext/ldap/php_ldap.h:27:0, from main/internal_functions.c:50: /usr/include/lber.h:335:1: note: previous declaration of ‘ber_scanf’ was here ber_scanf LDAP_P(( ^ make: *** [main/internal_functions.lo] Error 1 Can anyone offer me some ideas? Thanks in advance. -John -- John Stokes – Certified Oracle of Security seeking Zend wearing a Red Hat. (CISSP, ZCE, RHCSA) Software Engineer Verizon Wireless - West Territory Data Tools & Reporting *Three Pillars: Humility, Communication, Balance* -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP 7 and sqlsrv
On 4/10/15 3:20 PM, Jim Giner wrote: On 4/10/2015 4:03 PM, John Hermsen wrote: I was wondering if there is anyone who manager to compile the sqlsrv driver for php 7. I have tried, but I haven't been able to get it compiled yet. Thanks, John php 7?? I didn't even see php 6 go past me! Here's some info about PHP 7: https://wiki.php.net/rfc/php7timeline https://wiki.php.net/rfc#php_70 -- christopher.jo...@oracle.com http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Probleme upper accents
On 4/5/13 7:23 AM, Matijn Woudt wrote: On Fri, Apr 5, 2013 at 3:19 PM, Toby Hart Dyke t...@hartdyke.com wrote: It looks similar to this bug: http://bugs.php.net/bug.php?**id=54379http://bugs.php.net/bug.php?id=54379- possibly fixed in a later version? Your PHP is pretty elderly. Toby I would suggest to upgrade the full system. LC_* shows the OS is using ISO-8859-1, which is extremely outdated. It should use UTF-8 of course, or at least the ISO-8859-15. The database uses ISO-8859-15, and then you output it to the browser (without converting it I assume), and you tell the browser it is UTF-8 data? About your problem, it seems Toby is right about the bug report. It seems it has not been fixed yet, there is a patch but devs didn't find I good enough it. You might want to look at the options to use an ISO-8859-15 connection instead of UTF-8 while the bug has not been fixed. - Matijn A PHP upgrade will fix various things in PDO and a few things in PDO_OCI. I don't know if your current issue is one of them. OCI8 is the preferred driver for Oracle DB access. It is maintained and has performance features that PDO_OCI doesn't have: connection pooling, statement caching etc. The bigger issue is there aren't any PDO_OCI developers. Also no one is overseeing the PDO project (all drivers) so it is decaying and fragmenting. (Volunteers to assist are welcome). Even the MySQL team would recommend mysqli instead of PDO_MYSQL. Chris -- christopher.jo...@oracle.com http://twitter.com/ghrd Newly updated, free PHP Oracle book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Debugger
On 10/24/2012 05:02 PM, Ethan Rosenberg, PhD wrote: Dear list - A. Is anyone aware of a debugger that: 1] will step thru the code, 2] will stop at a point that input is requested [eg, form] and allow input? B. Aptana gives the following message: 'Launching Firefox' internal server has failed. Server configuration null not found. Advice and help, please. Ethan Look at NetBeans with XDebug: http://netbeans.org/kb/trails/php.html http://netbeans.org/kb/docs/php/debugging.html Chris -- christopher.jo...@oracle.com http://twitter.com/#!/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle NClobs
On 08/05/2011 09:08 AM, Lester Caine wrote: n.a.mor...@brighton.ac.uk wrote: Can anyone help please? I am using Oracle 10g (10.2.0.3) with PHP 5.2.5. It may not be related, but there were a number of issues with BLOB ids in Firebird which were not fixed until 5.2.7, I don't have anything that old running now, but I think that it was not only Firebird that was affected by the problem. It's not related in any way. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle NClobs
On 08/05/2011 08:55 AM, n.a.mor...@brighton.ac.uk wrote: Guys, Can anyone help please? I am using Oracle 10g (10.2.0.3) with PHP 5.2.5. The following piece of code works with a CLOB, but not with an NCLOB. Can anyone shed any light please? There is no support for NCLOB in PHP OCI8. Chris $SQL = UPDATE $d_sid.srs_spd SET spd_fuld = EMPTY_CLOB() WHERE spd_stuc = :stuc AND spd_seqn = :seqn AND spd_pdtc = 'VOAM' returning spd_fuld into :THE_CLOB ; $Clob = oci_new_descriptor($conn, OCI_D_LOB); $stmt = oci_parse($conn,$SQL); if (!is_resource($stmt)) throw new Exception(Internal Error: E_SPD_POPULATE (Parse 2)); oci_bind_by_name($stmt,:stuc,$V-Get(Student)); oci_bind_by_name($stmt,:seqn,$Out); oci_bind_by_name($stmt,:THE_CLOB, $Clob, -1, OCI_B_CLOB); $exec = oci_execute($stmt, OCI_DEFAULT); if (!$exec) throw new Exception(Internal Error: E_SPD_POPULATE (Exec 2)); $Clob-save($this-EMail); if (!oci_commit($conn)) { oci_rollback($conn); throw new Exception(Internal Error: E_SPD_POPULATE - Can't Save Character Large Object); } Regards, Neil Morgan PGCert MSc IT Services University of Brighton Watts 137 Lewes Road Brighton BN2 4GJ 01273 643930 ___ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___ -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle PDO UTF-8 problem
Glad you resolved it. Overall, I have to recommend the OCI8 extension over the unmaintained (like much of PDO) PDO_OCI extension. Chris On 01/13/2011 11:36 PM, Karsten Lehmann wrote: I found out that the error depends on the wrong character set of the Oracle Database. In my case this was a Western Europ instance of the Database. The same data on a UTF8 instance was displayed as excpected. Am 13.01.2011 10:42, schrieb Karsten Lehmann: Doesn't work. I got the following error after i set the parameter in the PDO construct Fatal error: Undefined class constant 'MYSQL_ATTR_MAX_BUFFER_SIZE' IMHO this is only a MYSQL parameter but i worked with oracle. Am 13.01.2011 10:27, schrieb kesavan trichy rengarajan: Try increasing this: PDO::MYSQL_ATTR_MAX_BUFFER_SIZE More info here: http://php.net/manual/en/ref.pdo-mysql.php On Thu, Jan 13, 2011 at 7:23 PM, Karsten Lehmannlehm...@maqsima.de wrote: Hello I try to read a 2000 character long string out of database. The database is an oracle 10g Express Edition with UTF-8 character set. To read the string we use the PDO abstraction layer with oci-driver. If the 2000 character contains one or more UTF-8 characters we get the problem that PDO truncate the result of the database, with the following message: Warning: PDOStatement::fetchAll() [pdostatement.fetchall]: column 5 data was too large for buffer and was truncated to fit it in C:\wamp\www\wp\bp.php on line 115 The definition of the database column is TESTSTRING VARCHAR2(2000 CHAR) CHAR means that we can store up to 2000 characters independent from the encoding of the character (e.g. UTF8). I also init the PDO with UTF8 $dbh = new PDO('oci:dbname=' . $db_name . ';charset=UTF8', $db_user, $db_pw); If i read the same string with java and JDBC-driver it works fine, so i can exclude a database error. How i have to configre PHP/PDO to be aware of the truncation of the result string? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_commit always returns true even when the transaction fails.
ZeYuan Zhang wrote: Hi there. Why oci_commit function always returns true even when the transaction fails. I just copied the code in the php manual [Example 1636. oci_commit() example], and runned it, the situation is as follows: * The statements do commit at the moment when oci_commit executes. * But some statements are committed to oracle successfully, when some fails. I think it cannot be called a transaction, and I did used OCI_DEFAULT in the oci_execute function. Code: ?php $conn = oci_connect('scott', 'tiger'); $stmt = oci_parse($conn, INSERT INTO employees (name, surname) VALUES ('Maxim', 'Maletsky')); oci_execute($stmt, OCI_DEFAULT); Add some error checking for oci_execute() - you might find failure is happening before you even get to commit. $committed = oci_commit($conn); if (!$committed) { $error = oci_error($conn); echo 'Commit failed. Oracle reports: ' . $error['message']; } ? $committed is always true, whenever $stmt executes successfully or fails. I use PHP5.2.12, apache_2.0.63-win32-x86-openssl-0.9.7m.msi, windows xp, Oracle10.1 and oci8 1.2.5. thanks. -- paravoice The following code show oci_commit failing. It gives me: $ php52 commit_fail.php First Insert Second Insert PHP Warning: oci_commit(): ORA-02091: transaction rolled back ORA-02290: check constraint (CJ.CHECK_Y) violated in commit_fail.php on line 57 PHP Fatal error: Could not commit: in commit_fail.php on line 60 Chris - ?php ini_set('display_errors', 'Off'); // Uses deferred constraint example from // http://www.oracle.com/technology/oramag/oracle/03-nov/o63asktom.html $c = oci_connect('cj', 'cj', 'localhost/orcl2'); if (!$c) { $m = oci_error(); trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR); } $stmtarray = array( drop table t_tab, create table t_tab ( x int constraint check_x check ( x 0 ) deferrable initially immediate, y int constraint check_y check ( y 0 ) deferrable initially deferred) ); foreach ($stmtarray as $stmt) { $s = oci_parse($c, $stmt); $r = oci_execute($s); if (!$r) { $m = oci_error($s); if (!in_array($m['code'], array( // ignore expected errors 942 // table or view does not exist , 2289 // sequence does not exist , 4080 // trigger does not exist , 38802 // edition does not exist ))) { echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; } } } echo First Insert\n; $s = oci_parse($c, insert into t_tab values ( 1,1 )); $r = oci_execute($s, OCI_DEFAULT); if (!$r) { $m = oci_error($s); trigger_error('Could not execute: '. $m['message'], E_USER_ERROR); } $r = oci_commit($c); if (!$r) { $m = oci_error($s); trigger_error('Could not commit: '. $m['message'], E_USER_ERROR); } echo Second Insert\n; $s = oci_parse($c, insert into t_tab values ( 1,-1)); $r = oci_execute($s, OCI_DEFAULT); // Explore the difference with and without OCI_DEFAULT if (!$r) { $m = oci_error($s); trigger_error('Could not execute: '. $m['message'], E_USER_ERROR); } $r = oci_commit($c); if (!$r) { $m = oci_error($s); trigger_error('Could not commit: '. $m['message'], E_USER_ERROR); } $s = oci_parse($c, drop table t_tab); oci_execute($s); ? -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/ugpomhome -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_commit always returns true even when the transaction fails.
Chris wrote: ZeYuan Zhang wrote: Hi there. Why oci_commit function always returns true even when the transaction fails. I just copied the code in the php manual [Example 1636. oci_commit() example], and runned it, the situation is as follows: * The statements do commit at the moment when oci_commit executes. * But some statements are committed to oracle successfully, when some fails. I think it cannot be called a transaction, and I did used OCI_DEFAULT in the oci_execute function. Code: ?php $conn = oci_connect('scott', 'tiger'); $stmt = oci_parse($conn, INSERT INTO employees (name, surname) VALUES ('Maxim', 'Maletsky')); oci_execute($stmt, OCI_DEFAULT); Reading the docs (straight from http://www.php.net/manual/en/function.oci-commit.php). A transaction begins when the first SQL statement that changes data is executed with oci_execute() using the OCI_NO_AUTO_COMMIT flag. You need to oci_execute($stmt, OCI_NO_AUTO_COMMIT); OCI_NO_AUTO_COMMIT is a recently introduced alias for OCI_DEFAULT, so the original code is equivalent. This could be made clearer in the oci_commit documentation, but is explained on http://www.php.net/manual/en/function.oci-execute.php, which is where the flag is actually used. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/ugpomhome -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_commit always returns true even when the transaction fails.
Chris wrote: Christopher Jones wrote: Chris wrote: ZeYuan Zhang wrote: Hi there. Why oci_commit function always returns true even when the transaction fails. I just copied the code in the php manual [Example 1636. oci_commit() example], and runned it, the situation is as follows: * The statements do commit at the moment when oci_commit executes. * But some statements are committed to oracle successfully, when some fails. I think it cannot be called a transaction, and I did used OCI_DEFAULT in the oci_execute function. Code: ?php $conn = oci_connect('scott', 'tiger'); $stmt = oci_parse($conn, INSERT INTO employees (name, surname) VALUES ('Maxim', 'Maletsky')); oci_execute($stmt, OCI_DEFAULT); Reading the docs (straight from http://www.php.net/manual/en/function.oci-commit.php). A transaction begins when the first SQL statement that changes data is executed with oci_execute() using the OCI_NO_AUTO_COMMIT flag. You need to oci_execute($stmt, OCI_NO_AUTO_COMMIT); OCI_NO_AUTO_COMMIT is a recently introduced alias for OCI_DEFAULT, so the original code is equivalent. This could be made clearer in the oci_commit documentation, but is explained on http://www.php.net/manual/en/function.oci-execute.php, which is where the flag is actually used. Fair enough, thanks for the clarification :) No problems. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/ugpomhome -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_commit always returns true even when the transaction fails.
echo Second Insert\n; $s = oci_parse($c, insert into t_tab values ( 1,-1)); $r = oci_execute($s, OCI_DEFAULT); // Explore the difference with and without OCI_DEFAULT if (!$r) { $m = oci_error($s); trigger_error('Could not execute: '. $m['message'], E_USER_ERROR); } $r = oci_commit($c); if (!$r) { $m = oci_error($s); Correction: the two oci_error() calls after oci_commit() should use the $c connection resource, not $s, e.g.: $m = oci_error($c); trigger_error('Could not commit: '. $m['message'], E_USER_ERROR); } $s = oci_parse($c, drop table t_tab); oci_execute($s); ? -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/ugpomhome -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ocilogon core dump on Solaris 10 X86 with php-5.2.9 and Oracle 10g
At a guess, there is a clash with the SSL libraries or it is a libpthread problem - google around for background. Chris Andre LAGADEC wrote: Hello, I am on Solaris 10 X86 with DELL IP , and I compile Php-5.2.9 with Apache2, Mysql6 and Oracle10g with success. But when I want to connect to Oracle database I get a core dump. I use this code ?php $c=ocilogon('bceconsulter','bce','BCE'); print_r($c); Resource id #1 ocilogoff($c); ? and I run it with the command /usr/local/apache2_php5_2_9/bin/php -a I recompile PHP with --enable-debug and I run gdb to get a backtrace. I get this serveur7#/usr/local/apache2_php5_2_9/bin/php -a Interactive mode enabled ?php $c=ocilogon('scott','tigger','DB1'); Erreur de segmentation (core dumped) serveur7#gdb /usr/local/apache2_php5_2_9/bin/php ./core GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i386-pc-solaris2.10... Reading symbols from /usr/lib/libcrypt_d.so.1...done. Loaded symbols for /usr/lib/libcrypt_d.so.1 Reading symbols from /usr/local/imap-2007e/lib/libc-client.so...done. Loaded symbols for /usr/local/imap-2007e/lib/libc-client.so Reading symbols from /usr/lib/libz.so.1...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libexslt.so.0...done. Loaded symbols for /usr/lib/libexslt.so.0 Reading symbols from /usr/local/lib/libtidy-0.99.so.0...done. Loaded symbols for /usr/local/lib/libtidy-0.99.so.0 Reading symbols from /usr/lib/librt.so.1...done. Loaded symbols for /usr/lib/librt.so.1 Reading symbols from /usr/local/mysql-connector-c-6.0.2-solaris10-x86-32bit/lib/libmysql.so.16...done. Loaded symbols for /usr/local/mysql-connector-c-6.0.2-solaris10-x86-32bit/lib/libmysql.so.16 Reading symbols from /usr/local/lib/libmcrypt.so.4...done. Loaded symbols for /usr/local/lib/libmcrypt.so.4 Reading symbols from /usr/local/lib/libltdl.so.7...done. Loaded symbols for /usr/local/lib/libltdl.so.7 Reading symbols from /usr/lib/libldap.so.5...done. Loaded symbols for /usr/lib/libldap.so.5 Reading symbols from /usr/lib/libpam.so.1...done. Loaded symbols for /usr/lib/libpam.so.1 Reading symbols from /usr/local/lib/libintl.so.8...done. Loaded symbols for /usr/local/lib/libintl.so.8 Reading symbols from /usr/local/lib/libiconv.so.2...done. Loaded symbols for /usr/local/lib/libiconv.so.2 Reading symbols from /usr/lib/libsec.so.1...done. Loaded symbols for /usr/lib/libsec.so.1 Reading symbols from /usr/lib/libc.so.1...done. Loaded symbols for /usr/lib/libc.so.1 Reading symbols from /usr/sfw/lib/libfreetype.so.6...done. Loaded symbols for /usr/sfw/lib/libfreetype.so.6 Reading symbols from /usr/lib/libpng12.so.0...done. Loaded symbols for /usr/lib/libpng12.so.0 Reading symbols from /usr/lib/libjpeg.so.62...done. Loaded symbols for /usr/lib/libjpeg.so.62 Reading symbols from /usr/local/ssl/lib/libssl.so.0.9.8...done. Loaded symbols for /usr/local/ssl/lib/libssl.so.0.9.8 Reading symbols from /usr/local/ssl/lib/libcrypto.so.0.9.8...done. Loaded symbols for /usr/local/ssl/lib/libcrypto.so.0.9.8 Reading symbols from /usr/lib/libresolv.so.2...done. Loaded symbols for /usr/lib/libresolv.so.2 Reading symbols from /usr/lib/libm.so.2...done. Loaded symbols for /usr/lib/libm.so.2 Reading symbols from /usr/lib/libnsl.so.1...done. Loaded symbols for /usr/lib/libnsl.so.1 Reading symbols from /usr/lib/libsocket.so.1...done. Loaded symbols for /usr/lib/libsocket.so.1 Reading symbols from /usr/lib/libxml2.so.2...done. Loaded symbols for /usr/lib/libxml2.so.2 Reading symbols from /usr/lib/libkstat.so.1...done. Loaded symbols for /usr/lib/libkstat.so.1 Reading symbols from /usr/lib/libgen.so.1...done. Loaded symbols for /usr/lib/libgen.so.1 Reading symbols from /usr/lib/libdl.so.1...done. Loaded symbols for /usr/lib/libdl.so.1 Reading symbols from /usr/lib/libsched.so.1... warning: Lowest section in /usr/lib/libsched.so.1 is .dynamic at 0074 done. Loaded symbols for /usr/lib/libsched.so.1 Reading symbols from /produits/oracle/product/10.2.0/lib32/libclntsh.so.10.1...done. Loaded symbols for /produits/oracle/product/10.2.0/lib32/libclntsh.so.10.1 Reading symbols from /usr/lib/libthread.so.1... warning: Lowest section in /usr/lib/libthread.so.1 is .dynamic at 0074 done. Loaded symbols for /usr/lib/libthread.so.1 Reading symbols from /usr/lib/libxslt.so.1...done. Loaded symbols for /usr/lib/libxslt.so.1 Reading symbols from /usr/sfw/lib/libgcc_s.so.1...done. Loaded symbols for /usr/sfw/lib/libgcc_s.so.1 Reading symbols from /usr/lib/libpthread.so.1... warning: Lowest section in /usr/lib/libpthread.so.1 is .dynamic at 0074 done. Loaded symbols for /usr/lib/libpthread.so.1 Reading symbols from /usr/lib/libaio.so.1...done. Loaded symbols for /usr/lib/libaio.so.1 Reading symbols from
Re: [PHP-DB] dl () problem
Check the notes: http://www.php.net/manual/en/function.dl.php#function.dl.notes Christoph Rosse wrote: stupid question ... but did you restart apache after editing php.ini ? Sent from my iPhone On 26.01.2010, at 16:02, Murat Beyhan bey...@deprem.gov.tr wrote: Dear All, I have updated apache2 and php5 then I have faced the following message. I have set on Enable dl in php.ini file but still could not solve problem. Could you help me about this problem, please. Fatal error: Call to undefined function dl() in /usr/local/httpd/htdocs/zone/zone30.php on line 3 Murat Beyhan -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?
Andy Shellam (Mailing Lists) wrote: First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection. Therefore, providing you've configured PHP's --with-mysql and --with-pdo-mysql options with the same MySQL library, then as long as the host, username and password are the same, the same connection will be re-used for both the native (mysql_pconnect) connection and the PDO connection. The doc refers to the PHP end of the connection and only to any existing PDO connection. PDO uses a hash table for open connections which it scans for matches when a PDO connection call is executed. The hash key is unique and begins with PDO:DBH:DSN=. The mysql extension uses mysql_ for its hash key prefix. This mean the PHP data structures for persistent connections won't be shared between the two extensions. Whether the MySQL client library or the MySQL database reuses any connection data underneath, I don't know. In Oracle the answer would be that PDO_OCI and OCI8 connections are distinct and transactionally separate (though they could share the same database connection pool if one was enabled). Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?
Sara Leavitt wrote: How about combining MySQLi with mysql_pconnect? Assuming both are persistent, would those connections be shared? The goal here is to use prepared statements. I read that MySQLi only supports persistent connections in php version 5.3 which we are not yet running, but perhaps it would be worth waiting for 5.3. -Sara The mysqli extension appears to use mysqli_ as the hash key prefix so there won't be PHP connection structure sharing here either. Chris Christopher Jones wrote: Andy Shellam (Mailing Lists) wrote: First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection. Therefore, providing you've configured PHP's --with-mysql and --with-pdo-mysql options with the same MySQL library, then as long as the host, username and password are the same, the same connection will be re-used for both the native (mysql_pconnect) connection and the PDO connection. The doc refers to the PHP end of the connection and only to any existing PDO connection. PDO uses a hash table for open connections which it scans for matches when a PDO connection call is executed. The hash key is unique and begins with PDO:DBH:DSN=. The mysql extension uses mysql_ for its hash key prefix. This mean the PHP data structures for persistent connections won't be shared between the two extensions. Whether the MySQL client library or the MySQL database reuses any connection data underneath, I don't know. In Oracle the answer would be that PDO_OCI and OCI8 connections are distinct and transactionally separate (though they could share the same database connection pool if one was enabled). Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Potential changes for the OCI8 extension for Oracle 11.2
Now that Oracle Database 11.2 has been released (http://blogs.oracle.com/opal/2009/09/oracle_database_11gr2_enhancem.html), we'd like to make some enhancements to PHP OCI8 for PHP 5.3.2 PHP 6: 1. Allow the oci_set_prefetch() count to be 0, i.e. just fetch/buffer one row at a time and don't prefetch any extra rows. Passing REF CURSORS back and forth between PL/SQL and PHP is one case where you might not want any extra rows prefetched. 2. Add a few oci_set_* functions to set database attributes including the new EDITION (useful for application upgrading, http://blogs.oracle.com/opal/2009/09/upgrading_php_web_applications.html), and a few APPINFO-style settings (very useful for tracing auditing). Send me any comments or questions. PHP OCI8 remains open source and contributions from the community are welcome. Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What's the number scheme for 'colno' for Select call in PDO driver
Sanjeev Kumar wrote: Hi, In the implemetation of Pdo-driver (extension) , what's the Sequence/Index scheme for parameter: 'colno' ? This param 'colno' is input in driver calls (of PDO statement) : int SKEL_stmt_describe_col(pdo_stmt_t *stmt, int colno TSRMLS_DC) int SKEL_stmt_get_col_data(pdo_stmt_t *stmt, int colno, ...) e.g If the script has cmds: Insert into Table test1(col1 int, col2 string, col3 real) SELECT col2,col3 from test1; The driver would which values for colno ? -sanjeev In ext/pdo/php_pdo_driver.h: /* queries information about the type of a column, by index (0 based). * Driver should populate stmt-columns[colno] with appropriate info */ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC); Colno is a 0 based relative to the columns used in the query. A working example is oci_stmt_describe() in ext/pdo_oci/oci_statement.c. This callback is assigned to the describer field of oci_stmt_methods at the bottom of the same file. The callback gets called from pdo_stmt_describe_columns() in ext/pdo/pdo_stmt.c. Similarly, see oci_stmt_get_col() for the second skeleton function you mention. Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fedora 9--10 ..now oracle connect error
Fred Silsbee wrote: Oracle Connect Error What error? What Oracle client libraries do you have? Where are they located just upgraded Fedora 9-10 using new php.ini file containing: ; Note: packaged extension modules are now loaded via the .ini files ; found in the directory /etc/php.d; these are loaded by default. I tried entering a file oracle.ini containing: ; Enable mysql extension module extension=oci8.so exists also in php.ini ..so files are where they ought to be Which is where? What is extension_dir set to? What is LD_LIBRARY_PATH set it in the Environment (not the Apache Environment) of phpinfo() output? mysql works with php as before update -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fedora 9--10 ..now oracle connect error
Fred Silsbee wrote: in /etc/httpd/conf/httpd.conf SetEnv ORACLE_HOSTNAME localhost.localdomain SetEnv TNS_ADMIN /u01/app/oracle/product/11.1.0/db_1/network/admin SetEnv ORACLE_BASE /u01/app/oracle SetEnv ORACLE_HOME /u01/app/oracle/product/11.1.0/db_1 SetEnv ORACLE_SID lmkiiiGDNSID SetEnv ORACLE_TERM xterm SetEnv LD_LIBRARY_PATH /u01/app/oracle/product/11.1.0/db_1/lib From experience, using Apache's SetEnv directive is sometimes insufficient to set the environment. See Where do I set Oracle environment variables? in http://wiki.oracle.com/page/PHP+Oracle+FAQ Also see page 105 onwards in http://www.oracle.com/technology/tech/php/underground-php-oracle-manual.html On RHEL and Oracle EL I put the environment variables in /etc/sysconfig/httpd (as shown on page 108). Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Prepared Statement Insert Problem
kesavan trichy rengarajan wrote: could be rewritten as: mysqli_stmt_bind_param($submitadmin, isss, $numrows, $admin, sha1($password), $email); Turning on E_STRICT in PHP 5.3 will show PHP Strict Standards: Only variables should be passed by reference This is also true in earlier versions although the warning isn't displayed. For compliance, try: $s = sha1($password); mysqli_stmt_bind_param($submitadmin, isss, $numrows, $admin, $s, $email); Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PDO Mysql and FETCH::ASSOC
Thomas Robitaille wrote: I've managed to fix the issue by switching to a 32-bit installation of MySQL and Apache. The problem appeared to be due to the 64-bit versions somehow. If you think there's a bug (and you tested the latest version of PHP), please report the problem at http://bugs.php.net/ Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour
Grant Croker wrote: DYLD_LIBRARY_PATH=/opt/oracle/instanceclient LD_LIBRARY_PATH=/opt/oracle/instanceclient ORACLE_BASE=/opt/oracle/instanceclient ORACLE_HOME=/opt/oracle/instanceclient export DYLD_LIBRARY_PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME (note: As Chris Jones mentioned LD_LIBRARY_PATH is not used on OS X, however there is no harm in having it set) Thanks for your help getting this resolved. FWIW, I just merged a change to the originally reported Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. message. On Mac OS X this now mentions DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH: http://cvs.php.net/viewvc.cgi/pecl/oci8/oci8.c?r1=1.269.2.16.2.38.2.31r2=1.269.2.16.2.38.2.32 This fix is incorporated into OCI8 1.3.5 downloadable from http://pecl.php.net/package/oci8 It will be available with PHP 5.3 (whenever that comes out). Users of older versions of PHP including PHP 5.2 are encouraged to upgrade OCI8 using PECL. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour
Chris wrote: Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in/Library/WebServer/Documents/oracle.php on line 25 Oracle Connect Error snip putenv(LD_LIBRARY_PATH=/opt/oracle/instanceclient); I'd guess you probably need this in apache's start up script, not in php (where that is on a mac setup I have no idea). You could also try it in your virtual host: http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient I agree that using putenv() for Environment variables in scripts is bad. On Mac, I think you need DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. See http://www.oracle.com/technology/pub/articles/bibbs-php-leopard.html Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sqlnet.ora doesn't seem to be read since oci8 1.3.4
Jérôme Loyet wrote: Hello, I used to use oci8 version 1.2.3 and I wanted to update to last version (1.3.4). Everything works fine except the fact that sqlnet.ora does not seems to be read. I use the following string to describe my database in oci_connect: MEN1PRD. In sqlnet.ora there is the parameter NAMES.DEFAULT_DOMAIN which is set to WORLD. In the tnsname.ora I have a full definition for MEN1PRD.WORLD. With oci8 1.2.3, it worked but since I upgraded to 1.3.4 this is not the case anymore. I have to use the same ID in oci_connect and tnsname.org. The sqlnet.ora NAMES.DEFAULT_DOMAIN does not seem to be used anymore. Where are your network files located and how you tell PHP where to find them. Do you set ORACLE_HOME or TNS_ADMIN? Where are they set? At a wild guess, perhaps you are using putenv() in your scripts - which is never recommended. See page 106 of the current (1.5) version of http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf on how to set environment variables. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sqlnet.ora doesn't seem to be read since oci8 1.3.4
Jérôme Loyet wrote: My init script where the ENV are set: export ORACLE_HOME=/usr/local/oracle/VERSIONS/Linux/CL.9.2.0 PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/network/admin:$ORACLE_HOME/lib:/usr/local/bin (The admin and lib directories aren't needed in the PATH because they don't contain executables.) export ORACLE_SID=MEN1PRD export HOSTNAME=`hostname` export NLS_LANG=FRENCH_FRANCE.WE8ISO8859P15 export LC_ALL=fr_FR export LANG=fr_FR Does phpinfo() show these all set in the Environment section? (see the Underground Manual again). Is sqlnet.ora readable by the Apache process? What directory is it in? Try moving it to /etc/sqlnet.ora (since this is a default search location). Php is loaded by apache as a module OCI8 is compile into PHP and is not a shared module As I explain it before, nothing as changed but the OCI8 version. The ENV var are set the same way. The OCI initialization function used by OCI8 was standardized to OCIEnvNlsCreate() in 1.3.4. But sqlnet.ora should definitely still be usable. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_connect returns warning if provided with the 4th param(charset)
Tonado wrote: Hi all, I used the following in my code oci_connect('$user','$pass',$connectionString,'UTF8'); and got the following warning: Warning: oci_connect() [function.oci-connect]: Invalid character set name: UTF8 I tried many times and found it could only work when I removed 'UTF8' or replaced it with 'US7ASCII'. It didn't work even I used 'WE8ISO8859P1'. But I had to use 'UTF8' in order to support multiple bytes. I had tried setting NLS_LANG to AMERICAN_AMERICA.UTF8 in envvars instead of using the 4th parameter in oci_connect, but it didn't work. Using putenv to set NLS_LANG didn't work either. Did you build PHP with Oracle XE libraries? Some versions of Oracle libraries support a restricted set of character sets to reduce size. For example, Oracle Instant Client Basic Lite has only English error messages and Unicode, ASCII, and Western European character set support. Oracle XE comes in two bundles, one supporting only the character set WE8MSWIN1252, the other AL32UTF8. See http://www.oracle.com/technology/software/products/database/xe/files/install.102/b25144/toc.htm#BABJACJJ Oracle's general name for UTF8 is AL32UTF8. A list of character set names is at: http://download.oracle.com/docs/cd/B28359_01/server.111/b28298/applocaledata.htm#i635047 Does anyone encounter this weird issue before? The php version I'm using is 5.2.1. PHP 5.2.1 is old now, and there have been many updates. If possible upgrade PHP. For all 5.2.x versions (including 5.2.8) I would upgrade at least the OCI8 extension to version 1.3. See http://pecl.php.net/package/oci8 Instructions are in http://tinyurl.com/UGPOM Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oracle pooling
Themis Vassiliadis wrote: DRCP is really a big improvement. But for me it has a great holdback: the pool controlled in the server side isn't defined for a specific schema, so if we have an application server serving different connections demanding different credentials certainly the performance will be worse. Another big problem is that one application hosted in the web server can lock the pool completely is the demand for this application improve. Pooled servers are internally sub-partitioned by user. See figure 3 in http://www.oracle.com/technology/tech/php/pdf/php-scalability-ha-twp.pdf This allows maximum reuse of pooled users for similar connections. DRCP is perfectly suited for systems with several credentials. I agree that if each and every connection comes in as a separate user then the benefits of DRCP will be reduced. But is conceivable in some cases that you can still take advantage of the already running server processes. In other hands if we work with traditional pooling, configured in the client side, we should define one pool for each aplication with his own credentials. The pool will never blocked by one system and for hosts with several credentials the performance will be better. The performance and availability will be insured. The DRCP pool is efficient and doesn't require many servers to handle load. Of course, this is application dependent. The worst case is a temporary shortage of pooled servers. Requests will block until a pooled server is free. But you can set the maximum number of pooled servers as high as your system limitations allow. This ensures the DB is still able to process requests without being totally overloaded. When load does decrease, the pool will shrink. Of corse both are good solutions, each one for your specific purpose. I agree that each application architecture may perform better with one or other solution. If you get a chance to try DRCP, let me know your experience. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oracle pooling
Themis Vassiliadis wrote: On Tue, Dec 2, 2008 at 4:18 PM, Christopher Jones [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Oracle 11g DRCP support is available in PHP. See this whitepaper: http://www.oracle.com/technology/tech/php/pdf/php-scalability-ha-twp.pdf Change the connection string slightly, and set one new php.ini parameter to use it. Chris I think that DRCP is a work around solution. I disagree. It is a major technology feature that enables pooling for a wide variety of client programs. It is extremely scalable. The whitepaper shows results from a small, commodity computer handling 20,000 concurrent connections. Of course is much better than traditional connections as we had before 11G. But I think that is really possible to develop a new extension working like Java component Apache DBCP. This is a traditional pooling mechanism, where is defined in a xml file the pooling description and it is ensured that just applications behind Tomcat will use the pool. The advantage of DRCP is precisely that it is server side: all your mid-tier application servers share the one pool on the DB server. It becomes easier to add web server machines, and their configuration is simpler. So if imbedded in an extension, the pool will start just when apache starts, and will down when apache stops. And the whole pooling definition will be at the client side. The main problem with mid-tier multi-threaded pooling solutions is that PHP is mostly run single-threaded because some PHP extensions are not thread safe. Pooling is a solution created for web applications, the DRCP, if I'm not wrong, should be used from web and client applications like SQL Plus. They just need to select the TNSNAME key and use the pool. When the DRCP server pool is started, applications can choose to use it, or they can continue to use dedicated connections if they want. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] what sets the ORACLE_HOME variable and sets PHP/Apache environment
Fred Silsbee wrote: GREAT!!but how! How what? http://us.php.net/manual/en/oci8.setup.php What about it? [phpinfo output of] Compile-time ORACLE_HOME no value The lack of a value here is an artifact aka buglet of installing from the PECL package. I'll add it to the todo list of issues to look at. To make this very clear: This particular part of the phpinfo() output is a message string constructed at compile time and doesn't matter that it isn't showing a value at run time. As explained in other messages forums, look for ORACLE_HOME in the Enviroment section of phpinfo(). If that isn't set, find out how to set environment variables for the Apache on your OS. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] close clue?
Fred Silsbee wrote: http://bugs.php.net/bug.php?id=43186 Why do you think it's a clue? Are you getting a crash? Does your PHP command line work? So far we have almost zero information about your configuration in particular we don't have phpinfo() output (despite suggestions you check it). Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_connect
Fred Silsbee wrote: I have the following in /etc/httpd/conf/httpd.conf SetEnv ORACLE_HOSTNAME localhost.localdomain SetEnv TNS_ADMIN /u01/app/oracle/product/11.1.0/db_1/network/admin SetEnv ORACLE_BASE /u01/app/oracle SetEnv ORACLE_HOME /u01/app/oracle/product/11.1.0/db_1 SetEnv ORACLE_SID lmkiiiGDNSID SetEnv ORACLE_TERM xterm SetEnv LD_LIBRARY_PATH /u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib I personally don't set them in httpd.conf because I don't believe putting them there works consistently across platforms. And we can't cross check your site because you haven't yet mailed the information I requested in more than one email/post. And I really doubt LD_LIBRARY_PATH being set before Apache executable starts is a good idea. I strongly suggest you set the environment in the shell that starts Apache: export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 export ORACLE_SID=lmkiiiGDNSID export LD_LIBRARY_PATH /u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib /usr/sbin/apachectl start (The other variables aren't needed) You may need to make sure these are set at boot time, if you Apache starts at machine boot. but showing in phpinfo is: oci8 OCI8 Support enabled Version1.3.4 Revision $Revision: 1.269.2.16.2.38.2.20 $ Active Persistent Connections 0 Active Connections 0 Compile-time ORACLE_HOME no value ?? Libraries Used no value Temporary Lob support enabled Collections supportenabled Directive Local Value Master Value oci8.connection_class no valueno value oci8.default_prefetch 100 100 oci8.eventsOff Off oci8.max_persistent-1 -1 oci8.old_oci_close_semantics Off Off oci8.persistent_timeout-1 -1 oci8.ping_interval 60 60 oci8.privileged_connectOff Off oci8.statement_cache_size 20 20 These values are not relevant to your problem. What is in the section with the heading Environment? Check for the ORACLE_HOME and ORACLE_SID variables there. On RHEL 5.2, if I use SetEnv in httpd.conf, I only see the variables in the Apache Environment section and not the Environment section of phpinfo(). NOTHING about Oracle in php.ini but there is a section about MySQL That's fine. Nothing needs to be set. Everything has a default. You can see the defaults in phpinfo output, and they are mostly tuning settings. You can add any configuration setting you want to change. Nothing there will affect a basic connection test script like the one you previously posted. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] what the php guys need to do
Fred Silsbee wrote: provide some detailed instructions for oc8/linux install that leave no gaps instructions that work for newbies For newbies we recommend installing Zend Core for Oracle. Are you the same person as person who has been posting to the OTN forum, e.g. this post http://forums.oracle.com/forums/thread.jspa?threadID=827600 I'll follow up on any OTN post (that I can understand). Also see http://tinyurl.com/f8jad, a new version of which will be out real-soon-now. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] what the php guys need to do
I'm CCing the php-db list. Fred Silsbee wrote: install Zend?...never! I have Fedora 9 and 11g1 Enterprise I have Apache working and Oracle 11g1 installed and working! Zend installs both of these and could screw up my working system. Zend Core for Oracle will use your existing Apache. It installs Instant Client 10gR2 in its own subdirectory and that should not affect any DB. Here is what I get from a browser for phpinfo.php: oci8 OCI8 Support enabled Great, you have PHP OCI8 installed correctly. I assume your 11g DB is running fine too. Now use SQL*Plus to connect to your database (from the machine where Apache/PHP is installed) and record: (i) the various Oracle-related environment variables set (ii) the connection string used Then, set those environment variables before starting Apache. Run a script ?php phpinfo(); ? and check in the Environment section that they are all there. In your PHP oci_connect() command, use the same connection details as you did in SQL*Plus. For example if you connect as: sqlplus hr/hrpwd then use $c = oci_connect(hr, hrpwd); Or if you connect like: sqlplus hr/[EMAIL PROTECTED] then use $c = oci_connect(hr, hrpwd, LMKIIIGDNSID); Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] what the php guys need to do
I'm CCing php-db again. Fred Silsbee wrote: This worked: sqlplus hr/[EMAIL PROTECTED] so I tried: (didn't work) if ($conn=oci_connect('hr', 'hr', '//localhost/LMKIIIGD')) Excuse me repeating the example PHP code I gave earlier for this SQL*Plus case: Or if you connect like: sqlplus hr/[EMAIL PROTECTED] then use $c = oci_connect(hr, hrpwd, LMKIIIGDNSID); Since you have a different password and SID, your code would be: $c = oci_connect(hr, hr, LMKIIIGD); This assume Apache (or the PHP command line) has the same environment as SQL*Plus - your post didn't mention whether it does or not. Also, running ?php phpinfo(); ? will show you where your php.ini file is. Edit php.ini and set display_errors=On for purposes of debugging (don't leave it on in production applications) Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] what sets the ORACLE_HOME variable and sets PHP/Apache environment
Fred Silsbee wrote: there is a file /etc/httpd/conf/httpd.conf I tried putting the ORACLE_HOME in this file but it failed What failed and how? How was it set? [phpinfo output of] Compile-time ORACLE_HOME no value The lack of a value here is an artifact aka buglet of installing from the PECL package. I'll add it to the todo list of issues to look at. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PECL-DEV] oci8
Hi Fred, [EMAIL PROTECTED] is a development mail list. The best place to post to is [EMAIL PROTECTED] I'm ccing that list: please remove pecl-dev from any followup mail. Fred Silsbee wrote: I have Fedora 9 2.6.27.5-37.fc9.i686 and Oracle 11g1 [EMAIL PROTECTED] oci8-1.3.4$ phpize also tried phpize.php bash: phpize: command not found I know on Redhat EL you need the php-pear and php-devel RPMs to get pecl, pear and phpize. the README says to run ,/configure but there is only config.m4 and config.w32 phpize creates configure. I am trying to get a PHP connection to Oracle 11g1 ?php if ($c = oci_connect('hr','hr','//localhost/lmkiiiGDNSID')) { echo Successfully connected to Oracle.\n; OCILogoff($c); } else { $err = OCIError(); echo Oracle Connect Error . $errtext; } ? I get no errors just doesn't work! Given the previous build failures it's unlikely this code will run. If you haven't set display_errors to On in php.ini you won't see any automatic PHP errors. Also, your error printing code should look like: echo Oracle Connect Error . $err['message]'; For information on OCI8 there are a number of books available, including my free PDF book at http://tinyurl.com/f8jad. (A new version of this book should be out in the next week or so: I've just finished my edits on it.) Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sql injections/best practises
mignon hunter wrote: Hi Christopher One other question. Our current site is written in jsp with Oracle. I'd like to use PHP. Do you have any thoughts on this? My recommendation is to utilize the existing skills you have; this echoes Fergus's comment. However, PHP is very popular and if you have the luxury of being able to learn a new language, choosing PHP is not like choosing an esoteric language that someone will struggle to maintain when you move on. We're not really using Jsp as it was intended ( like using classes ) and I think it has alot of overhead and is overkill. It seems Php would be a better choice for imbedded html. For the most part the site mainly consist of relatively simple db retrieval, for several of our products. Which then lists various documentation and reference material for each, all dynamic. And then we have a few very simple stand alone user input forms occasionally. Oracle is the db on most of the site - a little mysql too. PHP will certainly help you get a working website up quickly. Oracle can easily be accessed in PHP to do the things you describe. Discussion of frameworks and abstraction layers is just a way to make you aware of their place and to ensure the application is architected to suit your current future requirements. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sql injections/best practises
mignon hunter wrote: I'm am trying to find some definitive best practises on database connections with php on both mysql and oracle. I'm starting to redesign a corporate website and am trying to find out more about security and the best practises for database queries and user input form handling. For example - what's the best usage - prepared statements? And does it have to be php 5? I need preferably a one stop shop as opposed to looking at dozens of different places. Can you advise a particular book? Website? I have checked out the security area on the php manual and some users notes - some were useful. But it didnt really have a lot of info and I dont think it is comprehenive or all inclusive. Thanks in advance. PS I would like to switch the current site from jsp to php. I was going to look into Zend IDE. Comments? Suggestions? thanks PHP 5.2 is the way to go for new projects: PHP 4 isn't being maintained. Binding/preparing statements is the way to go. Here are quotes about them with MySQL Oracle They are useful for speeding up execution when you are performing large numbers of the same query with different data. They also protect against SQL injection-style attacks. (From PHP and MySQL Web Development, 4th Edition, Luke Welling and Laura Thomson) If I were to write a book about how to build nonscalable [note the NON] Oracle applications, then 'Don't Use Bind Variables' would be the title of the first and last chapters. [...] If you want to make Oracle run slowly [...] just refuse to use bind variables (From Expert Oracle Database Architecture, Tom Kyte) Depending on the site needs, consider a DB abstraction layer or a framework. For high performance connections in PHP OCI8 for Oracle, use oci_pconnect() and pass the character set. There are a number of Oracle-PHP books available. One free, introductory one is the Underground PHP Oracle Manual, http://tinyurl.com/f8jad (A new edition will be released in the next couple of weeks) Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci driver performance
Chris wrote: Hi all, Using php 5.2.6 + oci driver 1.3.4 from pecl Has anyone had any issues with the oci8 driver performance? I'm doing some profiling using xdebug and all of the time seems to be spent in oci_execute and oci_fetch_array. This shows up when I use jmeter to hit the app pretty hard. The data being returned is quite small (returning 10 rows) and the queries themselves are fast when run manually (or even through a separate script). They are fetching a lot of columns however. I eventually found the http://php.net/oci_internal_debug function and it shows a lot of OCIAttrGet calls. When I look at the oracle side of things, it's processing a lot of stuff but it's not out of control. I'm not sure what else to include so any suggestions/comments etc are most welcome. Thanks. The oci_execute oci_fetch_array calls will take the bulk of the time because there isn't much else to do for a query. Execution will, of course, take time while the DB is processing the query. So eliminate the DB configuration, character set conversion, etc as a cause first. The OCIAttrGet call are local calls and not the relatively expensive round-trip calls to the DB. Your comment about a lot of columns doesn't match the test you sent me offline: it only queries two columns. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using oci_execute
Walter Galvão wrote: Hi, Im using the oracle instant client basic in my php app, with apache server. When a query returns few rows, there is no problem. Otherwise, the oci_execute method doesn return any records neither errors! How can i solve this problem?? My implementation: function executarSQL($conn, $stmt, $consulta){ echo brbrExecute...; $r = oci_execute($stmt); if (!$r) { $erro = oci_error($stmt); trataErroSQL($conn, $consulta, $erro, execute); } echo brbrFim do Execute...; return $r; } What version of PHP? What version of Instant Client? What version of the DB? Are you exceeding the PHP script time out, or exceeding the memory limit? Is there an error from oci_parse or your fetch call? Which fetch call are you using? Does your error occur when there are lots of rows, or only when your query contains a certain kind of datatype? Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using oci_execute
Walter Galvão wrote: Are you exceeding the PHP script time out, or exceeding the memory limit? I dont know. Doesnt appear any message. The script prints the last message before the oci_execute call. I'd start by looking at the max_execution_time and memory_limit settings in php.ini. Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OCI
Daniel Brown wrote: On Mon, Jul 21, 2008 at 12:22 PM, Mad Unix [EMAIL PROTECTED] wrote: How could I build the OCI8 extension module for php5 under CentOS5? I have installe PHP/APACHE/MYSQL through yum install ... OCI8 is a PECL extension. 'pecl install oci8' If you need more help with that, you can either check Google or perhaps go directly to the PECL OCI8 page. You'll need to download and install Oracle Instant client 'basic' and 'devel' RPMs from http://www.oracle.com/technology/software/tech/oci/instantclient/index.html # rpm -i oracle-instantclient-basic-11.1.0.1-1.i386.rpm oracle-instantclient-devel-11.1.0.1-1.i386.rpm If pecl isn't available or fails, follow these steps. Download PHP's oci8 1.3.3 extension from PECL http://pecl.php.net/package/oci8 Build it: $ tar -zxf oci8-1.3.3.tgz $ cd oci8-1.3.3 $ phpize $ ./configure --with-oci8=shared,instantclient $ make Install it as root: # cd oci8-1.3.3 # make install Edit /etc/php.ini and add this line: extension=oci8.so If you don't have a DB, download and install Oracle XE database from http://www.oracle.com/technology/software/products/database/xe/index.html # rpm -i oracle-xe-univ-10.2.0.1-1.0.i386.rpm Configure XE: # /etc/init.d/oracle-xe configure Chris -- Email: [EMAIL PROTECTED] Tel: +1 650 506 8630 Twitter: http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No resultset with ocibindbyname
Roberto Mansfield wrote: PIDNOT NULLCHAR(8) I believe the problem has to do with your field type for PID. When you run: select * FROM projekte_generisch where pid='u0test' Oracle either autotrims or autopads (I'm not sure which) so that 'u0test' matches PID even though PID has a fixed 8-character length. But when you use bind variables, this doesn't happen. So you'll need to use: Hi Roberto, Well spotted! I can see a minor inconsistency between oci_bind_array_by_name() and the much older oci_bind_by_name() call. You can pass SQLT_AFC (i.e the CHAR type) to the former but not the latter. If anyone volunteers to write some test cases I can merge a patch to OCI8 to allow: oci_bind_by_name($s, ':bv', $bv, -1, SQLT_AFC); Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No resultset with ocibindbyname
Manuel Schölling wrote: Hi Christopher, thanks for caring about my problem. ;) I couldn't reproduce your problem. What does your table look like? What version of PHP OCI8? What version of Oracle? I using PHP 5.2.5 on a Linux 2.6.9 machine. The version of OCI8 is 1.2.4 (Revision 1.269.2.16.2.38, Oracle Instant Client Version 10.2). The output of select * from v$version is: Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production PL/SQL Release 8.1.7.0.0 - Production CORE 8.1.7.0.0 Production TNS for IBM/AIX RISC System/6000: Version 8.1.7.0.0 - Developmen NLSRTL Version 3.4.1.0.0 - Production And here is the output of desc projekte_generisch: NameNull? Type PID NOT NULLCHAR(8) ANFANG NOT NULLVARCHAR2(8) ENDEVARCHAR2(8) LAENGE NOT NULLNUMBER And of course the data record I am searching for. select * FROM projekte_generisch where pid='u0test' PID ANFANG ENDELAENGE u0test utest 8 Hope this helps diagnosting the error. Do other queries with binds work? Is PHP using the correct NLS language configuration? Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No resultset with ocibindbyname
Manuel Schölling wrote: Hi guys, sorry for spamming your mailing list. I have a strange problem with ocibindbyname(): I use this simple code to start an SQL query: But this query doesn't give me any data record (no error; empty resultset). I couldn't reproduce your problem. What does your table look like? What version of PHP OCI8? What version of Oracle? I tried this script: ?php $conn = oci_connect('hr', 'hrpwd', '//localhost/XE'); $stmtarray = array( drop table projekte_generisch, create table projekte_generisch (pid varchar2(40)), insert into projekte_generisch (pid) values ('einepid') ); foreach ($stmtarray as $stmt) { $s = oci_parse($conn, $stmt); @oci_execute($s); } $sql = Select * from projekte_generisch where pid=:data; $cur = oci_parse($conn, $sql); var_dump($conn, $cur, $sql); $pid = einepid; var_dump(ocibindbyname($cur, :data, $pid)); var_dump(oci_execute($cur)); print 'table border=1'; while ($row = oci_fetch_array($cur, OCI_RETURN_NULLS)) { print 'tr'; foreach ($row as $item) { print 'td'.($item?htmlentities($item):'nbsp;').'/td'; } print '/tr'; } print '/table' ? The output is: $ ~/php/bin/php t1.php resource(5) of type (oci8 connection) resource(9) of type (oci8 statement) string(48) Select * from projekte_generisch where pid=:data bool(true) bool(true) table border=1trtdeinepid/tdtdeinepid/td/tr/table (The value is repeated because the array contains numerically and associatively indexed values.) Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Retreving X, Y, Z from the Geometry column in oracle 10g
Hebat-Allah Farag wrote: I am stick since 2 days at the same point, I am using 10g, PHP my problem now is how to fecth the X, Y , z coordinates from the geometry column to view it on my web page, i don't understand the (SDO_ORDINATES), what is its type how i can deal with it. my simple code is: $conn=oci_connect('User','pass','//localhost/x') $sqlCol=SELECT c.GEOMETRY.SDO_ORDINATES from SSS c WHERE c.CODE = '80A' ; $resultCol=oci_parse($conn,$sqlCol); $excuteResCol=oci_execute($resultCol); $resultRecordsCol=oci_fetch_array($resultCol); I got an error on the last line as (ORA-00932: inconsistent datatypes: expected CHAR got ARRAY ) i don't know how to deal with this resultset. Since PHP's OCI8 deals with simple types (or arrays of simple types), you could create a mapping function in PL/SQL. There is a related example under the heading Using PL/SQL Types in PHP on page 141 of the current (1.4) version of http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf Also see the use of SDO_UTIL.GETVERTICES in http://forums.oracle.com/forums/thread.jspa?messageID=1448667#1448667 Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP ORACLE SSL ?
Narasimha Gangaiah wrote: Greetings, I am writing a web application using PHP. I want to use PEAR::DB to connect to user database. I want the connection to be secured using SSL. Does oci8.sl (php oracle dblibrary) support SSL connection to Oracle Server ? I know we can securely connect to MYSQL server using PEAR::DB SSL. Is it possible to estable secure connection to oracle server using PHP ? Best Regards Simha The network protocols used by Oracle can encrypt and/or checksum data transfers between Oracle library calls in PHP's oci8 extension and the database server. See http://download.oracle.com/docs/cd/B12037_01/network.101/b10772/asoconfg.htm#1006342 The useful bits are at the bottom of that page where the sample sqlnet.ora files are given (just above tables 3-2 and 3-3). In effect all you need to do is add a couple of configuration lines and restart the network listener to get encrypted traffic. Check your license too: the Advanced Security Option (ASO) is probably a separately licensble product. Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle TNS no listener
Make sure TNS_ADMIN is set to the directory name, not the file itself. Also consider using the Easy Connect syntax. We don't cover IIS in the Underground PHP Oracle Manual, but there may be some useful information e.g. on the various connection syntaxes in the OCI8 driver. The URL is: http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf I once blogged all the info about IIS and Oracle that I'd come across. http://blogs.oracle.com/opal/2006/05/01 You seem to have past the permission stage and it is probably a simple matter to get the connection going Chris David Mitchell wrote: Have you rebooted windows since setting the environment variable? I believe that's the only way for windows services to see the change. HTH On 6/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi All I've a bit code that connects to a remote Oracle DB, does a simple query and returns the result. Running from a Windows command prompt as php oratest.php the script runs fine and returns the results I'm expecting. If I run it through a browser I get oci_connect() [function.oci-connect]: ORA-12541: TNS:no listener in ... Webserver is IIS on my local box. PHP is running on my local box. I've got TNS_ADMIN set as an env variable Any help gratefully received :-) Cheers Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Book: http://tinyurl.com/f8jad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP with a XML database
What computing power would that be? XE (and even other editions of Oracle DB) install fine on small PCs with Linux or Windows. What performance you get will depend on your load. Best to benchmark it yourself, like you would benchmark the alternatives. On the use of PL/SQL, if you want to avoid this, you could return the XML to PHP. It may not be the most scalable solution, but it might satisfy your load. Chris Ritesh Nadhani wrote: Thank you. I dont think we have the computing power for this project to use Oracle 10g. Also, the system is too big and nobody out here has actual knowledge of Oracle but anyway I will keep it in mind. Ritesh [EMAIL PROTECTED] wrote: Ritesh, Don't know of a suitable XML database to use with PHP, but I could recommend using Oracle 10g. There are built in XML services that should help with your project. Furthermore, PHP has a well documented Oracle interface (OCI8) just for this. To handle the XML though, you would probably need to get to grips with PL/SQL, Oracle's own stored procedure and trigger language. And the best part, you could use OracleXE for free, although it only gives you a database with up to 4GB user data, up to 1GB of RAM and use of only one processor in a multi-processor environment. Regarsd, Neil -Original Message- From: Ritesh Nadhani [mailto:[EMAIL PROTECTED] Sent: 26 January 2007 06:43 To: php-db@lists.php.net Subject: [PHP-DB] PHP with a XML database Hello all As part of my research under my professor I have to implement a web interface to their benchmarking data. PHP is the chosen web language but we are little worried about the database. The benchmark data comes to us in XML format (e.g. http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml) . We have to implement an interface to query them, get data, update etc. We even can change schema in the form of attributes. . The data size would be around 100 MB each XML with around 100 different XMLs. The load would be max 5-10 users any given time, batch updates once a month and heavy load prolly 2-3 times a month. Mission criticality is not important, we can get it down sometimes. Which db would you suggest? i did google research and as of now - I like eXist, Sedna (they seem to have good PHP wrapper support) and TImber. Any suggestions? Ritesh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP with a XML database
Oracle XML DB support (often called XDB) is built into the Oracle database and therefore free once you have a DB. And the Oracle XE database is free. Best place to continue the discussion is on the forums http://www.oracle.com/technology/forums/xmldb.html and http://www.oracle.com/technology/forums/xml.html The people who monitor those lists are specialists. Chris Ritesh Nadhani wrote: I just checked: http://www.oracle.com/technology/tech/xml/xmldb/index.html Is the solution free or we have to pay license cost? I dont see any information about that. Christopher Jones wrote: What computing power would that be? XE (and even other editions of Oracle DB) install fine on small PCs with Linux or Windows. What performance you get will depend on your load. Best to benchmark it yourself, like you would benchmark the alternatives. On the use of PL/SQL, if you want to avoid this, you could return the XML to PHP. It may not be the most scalable solution, but it might satisfy your load. Chris Ritesh Nadhani wrote: Thank you. I dont think we have the computing power for this project to use Oracle 10g. Also, the system is too big and nobody out here has actual knowledge of Oracle but anyway I will keep it in mind. Ritesh [EMAIL PROTECTED] wrote: Ritesh, Don't know of a suitable XML database to use with PHP, but I could recommend using Oracle 10g. There are built in XML services that should help with your project. Furthermore, PHP has a well documented Oracle interface (OCI8) just for this. To handle the XML though, you would probably need to get to grips with PL/SQL, Oracle's own stored procedure and trigger language. And the best part, you could use OracleXE for free, although it only gives you a database with up to 4GB user data, up to 1GB of RAM and use of only one processor in a multi-processor environment. Regarsd, Neil -Original Message- From: Ritesh Nadhani [mailto:[EMAIL PROTECTED] Sent: 26 January 2007 06:43 To: php-db@lists.php.net Subject: [PHP-DB] PHP with a XML database Hello all As part of my research under my professor I have to implement a web interface to their benchmarking data. PHP is the chosen web language but we are little worried about the database. The benchmark data comes to us in XML format (e.g. http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml) . We have to implement an interface to query them, get data, update etc. We even can change schema in the form of attributes. . The data size would be around 100 MB each XML with around 100 different XMLs. The load would be max 5-10 users any given time, batch updates once a month and heavy load prolly 2-3 times a month. Mission criticality is not important, we can get it down sometimes. Which db would you suggest? i did google research and as of now - I like eXist, Sedna (they seem to have good PHP wrapper support) and TImber. Any suggestions? Ritesh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Building PHP with Oracle support
Wow - I suddenly realize It's been a long time since I compiled the obsolete oracle extension. We've done so much with the newer oci8 one recently. I had a similar problem with PDO_OCI recently that turned out to be a linking problem. Chris Andrew Bergman wrote: Hi, I am trying to compile PHP 5.2.0 on RedHat Enterprise Linux 4 AS 64 bit with Oracle support. (not oci8). The configure line I have used is: ./configure --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc/httpd/conf/httpd.conf --with-oracle=/export/oracle/pegasus/product/9.2.0 --with-ldap=/usr --enable-sigchild --enable-libgcc It compiles ok without error, however however when I view phpinfo I have no Oracle section. If I compile with --with-oci8=/export/oracle/pegasus/product/9.2.0 that compiles and shows OCI8 in the phpinfo however we aren't using oci8 for our application making that useless. I am not sure if it is an issue whereby it is compiled but no oracle support ended up compiling for whatever reason or a runtime issue where it is compiled with oracle support but is not finding something it needs when it runs in order for Oracle support to work. Anyone able to help? -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Apache 2.2 + PHP5.2 + php_oci8.dll
Hi James, From distant memory on 9i, all the software was in the one bundle. When you run the installer you can choose either client or server installs. There was no Instant Client with 9i. It was a new feature with 10g. Try using Zend Core for Oracle - it's the simplest way to install. You don't need to download a separate Oracle client to use it. Chris james tanhs wrote: Hi Chris, I read the write out and found that oracle 10g client only support 9i and above. So I assumed that it will not work with mine server runing on oracle8i (8.1.5) with 8 compatible set. Hence, I didn't try to install the 10g client for any testing. I will get it download later to have a try. Yup, I have visited http://www.oracle.com/technology/software/products/database/oracle10g/index.htmland Previous database releases. I am able to see the 10g client and 9i server is there but not the 9i client for linux ( I just wonder why). Thanks. On 12/27/06, Christopher Jones [EMAIL PROTECTED] wrote: PHP's oci8 extension on Windows is now compiled with an Oracle 10g client and depends on new functionality in it. The 10g Oracle Instant Client is freely available (and trivial to install) from http://www.oracle.com/technology/tech/oci/instantclient/index.html PHP configured with it will connect to Oracle 8i (aka 8.1) onwards, but not to Oracle 8.0. Zend Core for Oracle bundles Instant Client. Since you had problems with this, I'm wondering if the correct Oracle environment was set up for PHP? On #5, Oracle 9 on Linux is available from Oracle's database release download page. Follow the Oracle9i link beneath Previous database releases on http://www.oracle.com/technology/software/products/database/oracle10g/index.html Chris james tanhs wrote: Sorry, I posted into the php-general newsgroup earlier. Hi, I saw numerous posting on this type of posting and no one seems to have a consistent solution to it. Lately, I am quite disapointed with the pain of going thru this configuration and testing. I need to access the oracle 8i server db using XP + Oracle client 8i + Apache 2.2 + PHP5.2 and I have tried the following without success. What is the error ? not sumething special but common PHP Warning: PHP Startup: Unable to load dynamic library 'c:\\php52\\ext\\php_oci8.dll' - The specified procedure could not be found.\r\n in Unknown on line 0 1. download the php_oci8.dll from http://pecl4win.php.net/ext.php/php_oracle.dll (you name the version, tried everythign doesn't work) 2. assign ORACLE_HOME, NSL_LANGUAGE...nope...doesn't work. 3. use old php4.1.xx + Apache 1.3xx on XP with Oracle client 8i...nope doesn't work ( I use this in my NT4, it works like charm) 4. Zendcore for oracle...no no...it doesn't support Oracle 8i connectivity. 5. anyone know where to look for oracle 8i/9i clients for linux ? not available at oracle website :( Anyone can help ? Tq -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] My first try with PHP and Oracle ..
Matthias Bareuther wrote: Hello everybody, I'd like to connect to OracleDB using AdoDB. Here's my sourcecode so far : ?php error_reporting(E_ALL); include '/srv/www/htdocs/adodb/adodb.inc.php'; $conn = ADONewConnection('oracle'); $conn-debug = true; $conn-PConnect($host,$user, $pass, $dbase); ? When I load the site, it alway sais : 'MyServer-IP': Missing extension for native The AdoDB software is written in PHP and connects to your Oracle database using PHP's oci8 library calls. You can get AdoDB's Missing extension error when oci8 is not enabled in PHP. There are lots of installation documents that show how to configure PHP with oci8 enabled. One is at: http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] berkeley db + php + locking
Chris, I've emebedded inline an answer from George Feinberg from the Sleepycat team. Chris Chris Peiffer wrote: I'm having trouble getting php working with db4 so that it does correct write-locking in an apache webserver environment (where there are potentially many applications writing at once.) The first thing I did: I compiled the db4 package from sleepycat/oracle and configured it into php. (Using the --with-db4=/usr/local/BerkeleyDB.4.4 directive to php's configure.) With this the php binary is linked to the Berkeley libs, and one can use those libs through the standard php dba_* API, by opening db resources with the db4 handler, like this: $dbres = dba_open($filename, 'wd', 'db4'); This works for accessing, creating and writing files. However, it doesn't handle write locking properly. If two procs both call dba_open with a write lock, they both get the lock. Whover closes the resource first gets its values written to the file. This is not the correct behavior... you can't have a true mutex unless one of them blocks on the open when the write lock is taken up by the other. I found this page, which (poorly) documents the native php API for Berkeley db: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/ext/php.html From within the db distribution tree I installed their php extension, db4.so (by running phpize, configure, make, make install within the php_db4 directory under the db src.) I can get their samples to run, but the samples don't deal with write locking at all. The documentation is maddening, because most of it has to be inferred from the C API documentation. I'm finding it very hard to get any kind of error reports or logs out of the thing. This page suggests a scenario that I want: simple multiple reader / single writer access to a suite of db4 files: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/cam/intro.html However, it says You must specify DB_INIT_CDB and DB_INIT_MPOOL to DB_ENV-open. When I try to do this in php I get failure where the standard db-open succeeds. However, I can't figure out why. Similarly, cursor operations fail. Does anybody know of any good examples of using db4 and php? If you want to use DB_INIT_CDB, the syntax for the open call is: $env-open(path_to_environment, DB_INIT_CDB|DB_INIT_MPOOL|DB_CREATE); One note on the Berkeley DB PHP API -- it is not a wrapper of the complete API. It only implements a subset of the methods for any of the classes. If any are missing, and there is no work around, they can be requested. The Berkeley DB OTN Forum is the best place to talk about these issues, as it's monitored by the team. It's here: http://forums.oracle.com/forums/forum.jspa?forumID=271 The Db4Env class is particularly sparse, but that is because nearly all of its configuration can be emulated using a configuration file, rather than API. See the documentation on the DB_CONFIG configuration file here: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/db_config.html George Specifically, with locking? Is there any way to get db_strerror working? Is there at least a better documented API than the Oracle one? (As an example of how crappy it is, it omits the put method from class Db4 but that method does in fact exist within the library.) Thank you for any help you can offer. I have searched the web and the archives of this list but I couldn't find much. -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with executing Oracle query for creating procedure
Rosen wrote: Hi, i have problem with PHP and Oracle database. I read with PHP script an sql files like this: create or replace procedure test_proc1(p1 IN number, p3 OUT number) as begin p3 := p1 + 10; end; And when I execute it I receive an error: Warning: ociexecute(): OCIStmtExecute: OCI_SUCCESS_WITH_INFO: ORA-24344: success with compilation error in... And the procedue doesn't put in the database. When I edit the .sql file - all to be on 1 row - like this: create or replace procedure test_proc1(p1 IN number, p2 OUT number) as begin p2 := p1 + 10; end; Then I have no problems. Can someone help me with this? Thanks in advance, Rosen Normally I'd use a tool such as SQL Developer or SQL*Plus to pre-create database resident things like tables and PL/SQL procedures. However, back to your problem: use UNIX style end of line characters. Or build up the statement using PHP string concatenation. Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with Oracle
[EMAIL PROTECTED] wrote: In Oracle you would write: insert into pts (pid, txt) values (1,'502a'); But in PHP you are going to do the following: $conn = oci_connect('scott','tiger','my_db'); $sql = insert into pts (pid, txt) values (1,'502a'); $cursor = oci_parse($conn, $sql); if (! $cursor) { $err = oci_error($conn); print htmlentities($e['message']); exit; } $results = oci_execute($cursor); oci_commit($conn); oci_close($conn); The statements: $results = oci_execute($cursor); oci_commit($conn); do two commits. Oci_execute() commits by default. The message to the database to perform the commit is piggybacked in the execute call. However the subsequent (unecessary in this case) oci_commit() call requires an explicit round trip to the DB. If you were doing multiple inserts you might do something like: $s = oci_parse($c, 'insert into ptab (pdata) values (:bv)'); oci_bind_by_name($s, ':bv', $v, 20, SQLT_CHR); foreach ($a as $v) { $r = oci_execute($s, OCI_DEFAULT); } oci_commit($c); Or explore calling a PL/SQL block and do a bulk FORALL insert. I'll blog about bulk FORALL in a few days. Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php_oci8.dll
Marcos R. Cardoso wrote: I'm experiencing a disturbing problem with PHP 4.4.2, Win 2003 Server, Apache 2.0.58 and Oracle 9i. I've installed all the previously listed in a Web Server (though I've installed only the Net Client from Oracle 9i), but somehow there's a problem with the library php_oci8.dll Whenever I start the Apache2 service the following messages are written in Apache's error.log file: PHP Warning: Unknown(): Unable to load dynamic library 'C:\\php\\extensions\\php_oci8.dll' - N\xe3o foi poss\xedvel encontrar o m\xf3dulo especificado.\r\n in Unknown on line 0 I've seen this when php_oci8.dll can't find the Oracle libraries. A tool like listdlls will help show what's happening. In case it helps, there are various installation hints for PHP 5 and OCI8 in http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#notinst If you're using a DB (version 8,9 or 10) on another machine check the steps on using PHP with Oracle Instant Client, this should be easier to work with the the full Oracle client. Chris -- Christopher Jones, Oracle Corporation, Australia. Email: [EMAIL PROTECTED] Tel: +61 3 8616 3622 Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP + OCI en Debian
The original article on installing PHP with Oracle Instant Client is at http://www.oracle.com/technology/pub/notes/technote_php_instant.html Make sure you get the re-factored (i.e. much better) oci8 extension from http://cvs.php.net/php-src/ext/oci8/ or http://pecl.php.net/package/oci8 Chris (Sorry for late reply - I'm catching up from being out of the office for three weeks) SJL wrote: I was surfing in the web, and I found this: http://www.akadia.com/services/ora_php_linux.html Describe how to recompile php with oci8 librarys, in apache2 under Linux or Solaris. May be it will be usefull for someone else. Thanks anyway, Sebastian On 3/23/06, SJL [EMAIL PROTECTED] wrote: Ok, I think that you say to me that´s is not possible to compile oci8.c separate... When you say compile with extra option --with-oci8, you mean something like: make --with-oci8 makefile? Sorry for the ignorance... Thanks again, Sebastian On 3/22/06, Chris [EMAIL PROTECTED] wrote: SJL wrote: Someone install any time the Oracle Client to use the OCI interface to connect a Oracle DB? I'm working in Debian. I installed the Client of Oracle from a package from the official page... but I don´t know how to configure php.ini to make the OCI API works.. Now that you've installed Oracle Instant Client you need to get php to recognise it's there (so it can create the oci8.so file). I'm not sure if there is a package to do this or if you'll have to compile php from source with the extra option: --with-oci8 I suspect you'll have to compile php from source, you won't be able to use a package to do this, but I could be wrong. -- Postgresql php tutorials http://www.designmagick.com/ -- Christopher Jones, Oracle Corporation, Australia. Email: [EMAIL PROTECTED] Blog: http://blogs.oracle.com/opal/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle / Random errors
RIOTTEAU Gwénaël wrote: Hi, i try to connect my PHP application with Oracle. But i have some random errors (with the function OCIStmtExecute) : ORA-12152: TNS:unable to send break message ORA-03114: not connected to ORACLE sometimes it works well, sometimes not (for the same query) Random errors appear for all queries (simple or complexe) Serveur : Oracle 8i Client : library oci8 (Oracle Version 10.1) PHP : 4.4.2 Any idea ? Could be a threading issue, could be something else. Are you using the re-factored oci8 driver (from PECL)? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to lock multiple row in Oracle Db?
Rasim ÞEN wrote: Hi friends , my code like this $sql=SELECT mid,substr(ROWID,0,100) as nROWID,MEMBER_ID, NAME, SURNAME, E_MAIL, SUBJECT, MAIL_BODY, to_char(DATE_CREATED,'DD.MM. HH24:MI:SS') as DATE_CREATED, RETRY, PRIORITY, E_MAIL_FROM, RECEIVER_MEMBER_ID, RECEIVER_NAME, RECEIVER_SURNAME, MAIL_TYPE, ATTACHMENT1, ATTACHMENT2, EMBEDDING1, EMBEDDING2 FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum2000; putenv(NLS_LANG=TURKISH_TURKEY.WE8ISO8859P9); $baglanti = ocilogon(USERNAME,PASSWORD,DATABASE); $statement = ociparse ($baglanti, $sql); ociexecute ($statement); $i=0; while (ocifetchinto ($statement,$row, OCI_ASSOC)) { I want to lock this 2000 rows, for this I make query like below: $sql= .. FROM MEMBERS_TO_MAIL_SEND_HTML where flag=0 and rownum2000 FOR UPDATE; this time, it is updateting only one row. I tried to use LOCK TABLE table IN ROW SHARE MODE;LOCK TABLE table IN ROW SHARE MODE;; but I don't know how to use in php. How can I lock all rows, any advice ? Thanks a lot rasim Why do you think they are not being locked? Where and when is the UPDATE statement being executed? Tom Kyte may offer help on locking. For example, see http://asktom.oracle.com/pls/ask/f?p=4950:8:F4950_P8_DISPLAYID:927629362932 Finally, I suggest using the refactored OCI8 driver. This is currently available from http://pecl.php.net/package/oci8 and http://pecl4win.php.net/ext.php/php_oci8.dll Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CLOB-load() error (OCI8 against Oracle 10G )
What line of code is 1546? How are you binding/executing/fetching? Are you using OCI_B_CLOB? If you post a complete (small) testcase we may can look at it. Please include DDL to create any table. Most importantly, use the refactored OCI8 driver: http://pecl.php.net/package/oci8 -- cj Script This wrote: I have an OCI-Lob Object (in this case a clob) on which I am calling load(). I have identical code for a blob that works perfectly fine. I can't find any documentation or notes about this function or my error... Code that produces error: // i get here after succesfully executing // a select statement and getting back results if (is_object($row[EXCEPTIONS])) { // this call to load gives php warning below if (!($ans = $row[EXCEPTIONS]-load())) { $exceptions = print_r($row[EXCEPTIONS],1); error_log($row[QUESTION_ID] . : . $exceptions); } } else { $ans = $row[EXCEPTIONS]; } PHP Error: [07-Nov-2005 13:23:58] PHP Warning: load(): OCILobGetLength: OCI_INVALID_HANDLE in file.php on line 1546 Output from print_r($row[EXCEPTIONS]) [07-Nov-2005 13:23:58] OCI-Lob Object ( [descriptor] = Resource id #51 ) Is this a bug? I can't find any documentation or messages in the archives that have helpful information. Here are some details about my environment: PHP Version 4.3.10 System Info: Linux my.server.com 2.4.9-e.27smp #1 SMP Tue Aug 5 15:49:54 EDT 2003 i686 OCI information: OCI8 Supportenabled Revision$Revision: 1.183.2.16 $ Oracle Version 10.1 Compile-time ORACLE_HOME/oracle/product/10G Libraries Used no value If I add +OCI_RETURN_LOBS to my call to OCIFetchInto, I get all the right data back without having to call load, however, this will effectively break a LOT of code that deals with BLOBS. I will probably end up using this as a temporary fix in some manner that won't break the rest of the application. However, I would be very grateful to anyone who has a better solution...like how to get the load function to work on a CLOB that is most definitely already an OCI-Lob object? Thanks in advance -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP CLI OCILOGON - undefined function
Use the phpinfo() function to check that the same php is being used in Apache and on the command line. Make sure LD_LIBRARY_PATH contains $ORACLE_HOME/lib Relink with --with-oci8 Another suggestion is upgrade PHP to 4.4 and manually get the new refactored oci8 drivers. After you upgrade to something like: pear install oci8-beta to get the new drivers. Chris Sigrid Krug wrote: Hi! I scanned the web today and found people with the same problems, but no solutions. The problem is: I try to connect an Oracle-DB with a PHP-Command-Line-script. It works fine, when I use: ora_logon([EMAIL PROTECTED],tiger) But it doesn't with: OCILogon(scott, tiger, orcl) I just get: Fatal error: Call to undefined function: ocilogon() But via web-browser the scripts work phpinfo.php: PHP Version 4.2.3 Configure Command: './configure' '--with-oracle=/opt/oracle/product/92' '--with-apache=../apache_1.3.27' (here OCI8 is NOT mentioned, but all the scripts using OCI8 work fine, except on command line.) oci8 OCI8 Support enabled Revision $Revision: 1.169.2.3 $ Oracle Version 9.0 Compile-time ORACLE_HOME /opt/oracle/product/92 Libraries Used Apache/1.3.27 SuSe Linux Enterprise Server 8, I guess. I hope for help, Sigrid -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Can't compile Oracle's 10g support in PHP5
The --with-oracle option is a long deprecated interface to Oracle and no-one has updated the configure script to work with Oracle 10g. Can you use the new --with-oci8 option? Otherwise you'll need to update ext/oracle/config.m4. The code in ext/oci8/config.m4 may help. With either configure option, you need to specify the $ORACLE_HOME directory, not $ORACLE_HOME/lib. Chris Mário Gamito wrote: Hi, I'm trying to compile PHP 5.04 with support to Oracle 10g, but i always get the error: checking Oracle version... configure: error: Oracle needed libraries not found Well, i think i have Oracle's libs in /home/oracle/product/10.1.0/db_1/lib/ At least i have a lot of .so there. How can i get overcome this problem ? Any help would be apreciated. My configure folloows my signature. Warm Regards, Mário Gamito ./configure --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-openssl=/usr/local/ssl --enable-track-vars --with-xml --with-mcrypt --with-gettext --with-ldap --enable-sockets --enable-wddx --enable-xslt --with-xsltsablot --with-zlib --with-kerberos --enable-bcmath --with-bz2 --enable-calendar --with-lpeg-dir --with-tiff-dir --with-curl --with-curlwrappers --with-gdbm --with-expat --with-iconv-dir --with-dom-xslt --with-dom-exslt --with-dom --with-db4 -with-flatfile --with-fam --enable-exif --with-gd --enable-ftp --with-png-dir --with-xpm-dir --with-ttf --with-iconv --with-mhash --with-ncurses --enable-soap --with-readline --with-pear --with-oracle=/home/oracle/product/10.1.0/db_1/lib/ --with-apxs=/usr/local/httpd/bin/apxs --enable-sig-child -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php3 and oracle9i client libraries doesn't compile..
neil smith wrote: Hi Martin, It's a legacy application that is huge and sprawling and teh programmers who developed it left along time ago , apparently. It would probably be easier to write a whole new application then convert it to php 4 or 5 and thankfully thats not what I've been asked to do. psa - thanks for that!! would that be part of an oracle library? I can see Oracle 9.2 has a libpsa8.so and libpsa9.so Does your link work if the Makefile is changed to -lpsa9 or -lpsa8? Chris thanks, neil gt;From: Martin Norland lt;[EMAIL PROTECTED]gt; gt;Reply-To: php-db@lists.php.net gt;To: php-db@lists.php.net gt;Subject: Re: [PHP-DB] php3 and oracle9i client libraries doesn't compile.. gt;Date: Thu, 28 Apr 2005 09:31:33 -0500 gt; gt;neil smith wrote: gt;gt;I'm using this command to configure php3 gt;gt;./configure --with-apxs=/usr/local/apache/bin/apxs gt;gt;--with-config-file-path=/usr/local/lib --enable-versioning gt;gt;--enable-track-vars --with-oci8=/u01/app/oracle/product/9.2.0.4 gt;gt;--with-oracle=/u01/app/oracle/product/9.2.0.4 --enable-sigchild gt;gt; gt;gt;that works ok. But when I type make it eventually fails with this gt;gt;error: gt;gt; gt;gt;gcc -shared -o libphp3.so mod_php3.o libmodphp3-so.a gt;gt;-L/usr/local/lib -L/u01/app/oracle/product/9.2.0.4/lib -lclntsh gt;gt;-lpsa -lcore4 -lnlsrtl3 -lclntsh -ldl -lm -lpthread -lnsl -lirc gt;gt;-lgdbm -lpam -lm -ldl -lcrypt -lresolv gt;gt;-Wl,--version-script=/usr/php/php-3.0.18/php.map -Wl,-rpath gt;gt;/u01/app/oracle/product/9.2.0.4/lib gt;gt;/usr/bin/ld: cannot find -lpsa gt;gt;collect2: ld returned 1 exit status gt;gt;apxs:Break: Command failed with rc=1 gt;gt;make: *** [libphp3.so] Error 1 gt;gt; gt;gt; gt;gt; gt;gt;I don't understand enough about this compilation process to know gt;gt;what lpsa is and why it can't find it. Does anybody know how I can gt;gt;get php3 to work with oracle 9i client libraries? gt;gt;thanks in advance to anyone who can help. gt; gt;-lpsa means it's trying to link a library named 'psa' - off the top gt;of my head I can't say what that is, and a brief googling is proving gt;less than useful. gt; gt;--- end section where I am 'useful', on to questioning rant --- gt; gt;Can I ask why you're using such an old version of php? If it's for gt;a legacy application I can understand, but it seems like you're gt;giving up a LOT to stay on php3. In any case - looking at the gt;release dates for the two: gt; gt;http://www.oracle.com/technology/software/products/oracle9i/index.html gt;Oracle9i Database Release 2 Enterprise/Standard Edition for Linux gt;New (26-Mar-04) gt; gt;http://www.php.net/releases.php gt;3.0.x (latest) gt;# Released: 20 Oct 2000 gt; gt;I'd say you'd be better off trying your legacy app under php4 and gt;moving to that. If it's simply a register globals issue, then gt;you're no safer in php3 than you would be in php4 with it turned on, gt;so that's not a reason to stay back. gt; gt;good luck determining what psa is, I have to run to a meeting but I gt;may try looking again later. gt; gt;cheers, gt;-- gt;- Martin Norland, Sys Admin / Database / Web Developer, gt;International Outreach x3257 gt;The opinion(s) contained within this email do not necessarily gt;represent those of St. Jude Children's Research Hospital. gt; gt;-- gt;PHP Database Mailing List (http://www.php.net/) gt;To unsubscribe, visit: http://www.php.net/unsub.php gt; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description
Without real information I can only wonder and guess. Is TNS_ADMIN set to a directory or a file? It should be a directory. Try renaming sqlnet.ora temporarily or set the alias in tnsnames.ora to something like testdb.boo.com = (DESCRIPTION = ... Chris neil smith wrote: Hello chris, I've modified the variables in the apache user environment (in my case root at the moment) but that didn't amke any difference to php not being able to find tnsnames.ora. So the work around I've used is to use ORACLE_SID=desciption(...etc. SID = ))); ie the full description of the database alias within tnsnames.ora However this is not good, so if you have any other idea please let me know. I'm flumuxed. thanks, neil gt;From: Christopher Jones lt;[EMAIL PROTECTED]gt; gt;To: neil smith lt;[EMAIL PROTECTED]gt; gt;CC: php-db@lists.php.net, [EMAIL PROTECTED] gt;Subject: Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description hardcoded gt;Date: Wed, 20 Apr 2005 09:25:12 +1000 gt; gt;Make sure the environment variables are set in the shell that starts gt;Apache. See gt;http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#envvars gt; gt;Try changing your OCILogon command to gt; gt; $odbc = OCILogon(quot;yourusernamequot;,quot;yourpasswordquot;,$db); gt; gt;i.e. remove quot;/testquot; from the username parameter. gt; gt;Chris gt; gt;neil smith wrote: gt;gt;Hello, gt;gt; gt;gt;I have test script that can connect to the oracle database. It gt;gt;doesn't gt;gt;require tnsnames.ora because I define the database alias in the gt;gt;script gt;gt;itself. It looks like this: gt;gt; gt;gt; gt;gt; gt;gt;echo quot;TWO_TASK=quot;.getenv(quot;TWO_TASKquot;).quot;lt;brgt;quot;; gt;gt;echo quot;LD_LIBRARY_PATH=quot;.getenv(quot;LD_LIBRARY_PATHquot;).quot;lt;brgt;quot;; gt;gt;echo quot;ORACLE_BASE=quot;.getenv(quot;ORACLE_BASEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;ORACLE_HOME=quot;.getenv(quot;ORACLE_HOMEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;TNS_ADMIN=quot;.getenv(quot;TNS_ADMINquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;NLS_LANG=quot;.getenv(quot;NLS_LANGquot;).quot;.lt;brgt;quot;; gt;gt; gt;gt;# this allows a successful connection gt;gt; gt;gt;$db = quot; (DESCRIPTION = gt;gt; (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521)) gt;gt; (CONNECT_DATA= (SID = testdb)) gt;gt; )quot;; gt;gt; gt;gt;// these don't work.. php can't seem to find tnsnames.ora gt;gt;# $db = quot;testdb.boo.comquot;; gt;gt;//$db = quot;testdb.boo.comquot;; gt;gt;# $db = quot;testdbquot;; gt;gt;//echo $testdb; gt;gt; gt;gt; gt;gt;$odbc = OCILogon(quot;test/testquot;,quot;testquot;,$db); gt;gt; gt;gt;if ($odbc == false){ gt;gt; $msg = OCIError($odbc).quot;lt;BRgt;quot;; gt;gt;} else { gt;gt;echo quot;success!!!lt;brgt;quot;; gt;gt;} gt;gt; gt;gt; gt;gt; gt;gt;My problem is is that when I try to use the database alias in gt;gt;tnsnames.ora I gt;gt;get an ora-12154 error. I get this despite the facts that gt;gt;oracle_home, gt;gt;tns_admin and everything else is defined in the script and the gt;gt;tnsnames.ora gt;gt;contains exactly the same alias as I use in the hardcoded version gt;gt;(see the gt;gt;uncommented $db above). gt;gt;sqlnet.ora contains a value name_domain that apparently is appended gt;gt;to the gt;gt;alias in tnsnames.ora but accounting for this still doesn't let me gt;gt;connect gt;gt;to oracle . It's as if tnsnames.ora cannot be found. I've changed gt;gt;the gt;gt;permissions to 777 for the whole directory structure and I can gt;gt;successfully gt;gt;use tnsnames.ora with sqlplus or tnsping. gt;gt; gt;gt;Does anybody have any ideas what is going wrong? Is this a bug? gt;gt; gt;gt;thanks, gt;gt; gt;gt;neil gt;gt; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connect if description hardcoded
Make sure the environment variables are set in the shell that starts Apache. See http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#envvars Try changing your OCILogon command to $odbc = OCILogon(yourusername,yourpassword,$db); i.e. remove /test from the username parameter. Chris neil smith wrote: Hello, I have test script that can connect to the oracle database. It doesn't require tnsnames.ora because I define the database alias in the script itself. It looks like this: echo TWO_TASK=.getenv(TWO_TASK).br; echo LD_LIBRARY_PATH=.getenv(LD_LIBRARY_PATH).br; echo ORACLE_BASE=.getenv(ORACLE_BASE).BR; echo ORACLE_HOME=.getenv(ORACLE_HOME).BR; echo TNS_ADMIN=.getenv(TNS_ADMIN).BR; echo NLS_LANG=.getenv(NLS_LANG)..br; # this allows a successful connection $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521)) (CONNECT_DATA= (SID = testdb)) ); // these don't work.. php can't seem to find tnsnames.ora # $db = testdb.boo.com; //$db = testdb.boo.com; # $db = testdb; //echo $testdb; $odbc = OCILogon(test/test,test,$db); if ($odbc == false){ $msg = OCIError($odbc).BR; } else { echo success!!!br; } My problem is is that when I try to use the database alias in tnsnames.ora I get an ora-12154 error. I get this despite the facts that oracle_home, tns_admin and everything else is defined in the script and the tnsnames.ora contains exactly the same alias as I use in the hardcoded version (see the uncommented $db above). sqlnet.ora contains a value name_domain that apparently is appended to the alias in tnsnames.ora but accounting for this still doesn't let me connect to oracle . It's as if tnsnames.ora cannot be found. I've changed the permissions to 777 for the whole directory structure and I can successfully use tnsnames.ora with sqlplus or tnsping. Does anybody have any ideas what is going wrong? Is this a bug? thanks, neil -- Christopher Jones, Oracle Corporation, Australia. Email: [EMAIL PROTECTED] Tel: +61 3 8616 3622 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Losing the ability to connect to Oracle database
Leo D. Geoffrion wrote: I recently upgraded to PHP5 and now have a curious Oracle problem. The PHP scripts query the database fine. Then overnight, the database shuts down for backup and restarts. The next day, PHP can no longer connect to the database until I restart Apache. Then, it's happy until Oracle restarts the next night. We did not encounter this problem with PHP4. I've tried adjusting the php command from the old ocilogon() to oci_connect() but the problem continues. Incidentally, I am using a simple connection, not a persistent one. Can someone advise what's wrong here or how to get PHP/Apache to survive a database restart. There were some changes to connection in PHP5. I guess this might be a symptom, but I recall similar things reported with PHP4. Can you log a PHP bug so the problem can be tracked? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Blob problem (php and oracle)
Here are some things you could try. Remove all the @ suppressions and make sure error_reporting = E_ALL and display_errors = On are set in your php.ini. Echo the SQL statement inside SQLInsertLob() to make sure it is constructed OK. Echo the filename to check it includes the appropriate path. If there is no path, try using the absolute path e.g. /tmp/myfile.xml Check $this-ConnectionID is ok and you can do a simple query in SQLInsertLob(). Change $lob to $lob (this fixes a different problem). Chris EL Marouri Mounir wrote: hi all, i have a problem in saving a blob file into oracle database the system is linux 7.3 oracle 9i apache and php things are working pretty well in other machine (same php source code) but in my machine it gives this error savefile():OCILobWrite : OCI_INVALID_HANDLE. this is the php: $oci-SQLInsertLob(3, insert into FICHIER_BDS(FICH_BDS_ID, FICH_BDS_NOM, BDS_ID, FICH_BDS_SOURCE, FICH_BDS_XML, FICH_BDS_SIZE, FICH_BDS_TYPE, VER_ID) values (FICH_BDS_ID.nextval, ' .$file_name. ', $BDS_ID,'0',EMPTY_BLOB(), $file_size, ' .$file_type. ', ' .$VER_ID. ') returning FICH_BDS_XML into :the_blob,$file); } the oci function : function SQLInsertLob($num, $req, $lob_upload) { if ($num 0 || $num $this-NumReq) { $this-err = Numéro de statement incorrect; return false; } $lob = @OCINewDescriptor($this-ConnectionID, OCI_D_LOB); $this-Result[$num] = @OCIParse($this-ConnectionID, $req); @OCIBindByName($this-Result[$num], ':the_blob', $lob, -1, OCI_B_BLOB); @OCIExecute($this-Result[$num], OCI_DEFAULT); if($lob-savefile($lob_upload)) { return true; }else{ return false; } $lob-free(); @OCIFreeStatement($this-Result[$num]); } le file is temporary located in /tmp/ apache is runing with apache user when the file is created the permissions is rw--r--r--i have tried with file 777 to make sure but i still have the same error and then i have tried to execute the sql statement in sqlplus with '0' as blob the sql is OK in other page it can load blob file from oracle database i really don't see where is the problem if someone have any idea thanks to all __ Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OCI ignoring NLS_DATE_FORMAT parameter
Doug McMaster wrote: Regardless of how I set the NLS_DATE_FORMAT parameter, when I do a select statement DATE fields are returned in the Oracle default DD-MON-RR format. I can successfully set NLS_DATE_FORMAT using either an environment variable and restarting apache or by using ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM- HH24:MI:SS' (I would prefer to use this method). I can verify that the NLS_DATE_FORMAT is set to my desired format both before and after my select statement by running the query SELECT * FROM NLS_SESSION_PARAMETERS WHERE PARAMETER='NLS_DATE_FORMAT' in my script. This problem occurs with both PEAR DB, and with ADODB oci8 drivers. However if I use the ADODB oracle drivers, which use the older ora functions instead of the oci functions, ALTER SESSION works and I am able to retrieve dates in the format I set. Unfortunately, the software I'm working on uses PEAR DB_DataObject, and the PEAR DB Oracle driver uses the oci calls. Version info: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production PHP 4.3.4 Apache 1.3.29 Anyone have any ideas or suggestions on why I'm seeing this problem? Thanks, Doug In ADOdb, make sure to set the format before connecting: $db = ADONewConnection(oci8); // $db-debug = true; // Date format is set before connecting. $db-NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'; if ([EMAIL PROTECTED]Connect(false, scott, tiger)) error('Connect', $db-ErrorMsg()); In OCI8, see the scipt below. In PEAR, . . . it's been a while since I used dates in PEAR. Chris -- ?php $conn = OCILogon(scott, tiger); if (!$conn) { echo Error connecting; die; } query($conn, select * from nls_session_parameters where parameter='NLS_DATE_FORMAT'); query($conn, select sysdate from dual); alterdate($conn); query($conn, select * from nls_session_parameters where parameter='NLS_DATE_FORMAT'); query($conn, select sysdate from dual); exit; function query($conn, $query) { $stid = OCIParse($conn, $query); if (!$stid) { echo Error parsing; die; } $r = OCIExecute($stid, OCI_DEFAULT); if (!$r) { echo Error executing; die; } print 'table border=1'; while ($succ = OCIFetchInto($stid, $row, OCI_RETURN_NULLS)) { print 'tr'; foreach ($row as $item) { print 'td'.($item?htmlentities($item):'nbsp;').'/td'; } print '/tr'; } print '/table'; } function alterdate($conn) { $cmd = alter session set nls_date_format = '-MON-DD HH:MI'; $stid = OCIParse($conn, $cmd); if (!$stid) { echo Error parsing; die; } $r = ociexecute($stid, OCI_DEFAULT); if (!$r) { echo Error executing; die; } } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ocilogon timeout
Juffermans, Jos wrote: Hi, Some of our scripts that generate customer-facing pages, need a connection to a database. The problems is that the database is in Norway and - allthough we have a VPN setup - the connection isn't always available. In case the connection cannot be made, we can redirect the customer to a nice error page and ask them to try again later. That's not too hard. The issue is that it takes really really long before ocilogon returns if the connection cannot be established. Is it possible to set a timeout on ocilogon (like you can with eg fsockopen)? Rgds, Jos Look at the Oracle Net configuration and see if any parameters can be tweaked. For example, with Oracle 10.1, editing the client-side sqlnet.ora file and changing NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT) to NAMES.DIRECTORY_PATH= (TNSNAMES) removes an extra delay when the connection fails. In this example you lose the ability to use 10g Easy Connection syntax, which may not be important to you. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP-DB] Re: oci8 cannot connect after restarting DB
During my presentation at the PHP Conference in Frankfurt I put out a call for participation in creating a roadmap for Oracle connectivity in PHP. When I get back to work (I'm on a short vacation in Europe with intermittent email access) I'll be following up on this. While I'm away, feel free to fill my inbox with suggestions and discussion of your application architecture requirements. Chris PS The Zend guys have kindly offered to look at the commonly reported Windows/PHP5.0.2/OCI8 crash. Or if anyone is compiling this combo maybe they can contribute???---BeginMessage--- Hi John, Just saw your blog today on Andi's PHP5 / Oracle article. One of the two bugs you sited in your previous email was one that I opened (http://bugs.php.net/bug.php?id=30808) I'm not sure what the case is with the 4.3.x line, but my hunch this issue is 'bigger' than PHP5. More troubling is tony2001 response to my bug report (we don't want to turn on the noted fix, but will implement something workable with PDO). I'm anxious to hear his reply to my follow-up: it makes no sense to me that oracle users will have to settle for broken logon functions (with the fix sitting commented in the current code) or abandond the oci8 library all together for PDO when it hits the streets (which will be some time). Best, Michael -Original Message- From: John Lim [mailto:[EMAIL PROTECTED] Sent: Thursday, November 18, 2004 3:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: oci8 cannot connect after restarting DB Michael, After rereading your post again, i realise you mentioned it's happening with non-persistent connections also. That puzzles me. Perhaps we are talking about multiple bugs here. In general, I have not found PHP5 and oci8 to be very stable, and would not recommend moving anything production to use PHP5 just yet. Regardsd, John John Lim [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi This is because you are using persistent connections, which are left dangling and do not restart after the database restarts. Apparently you can hack your tnsnames.ora or oci8 extension. See http://bugs.php.net/bug.php?id=15390 and http://bugs.php.net/bug.php?id=30808 Regards, John Michael Caplan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Every evening, for whatever reason, our Oracle db (9.2.0) is restated. After it is restarted, I am unable to build a connection with Oracle from PHP untill Apache is restarted. Whenever I do an ociplogon() or ocilogon() following an Oracle DB restart, it fails but I am unable to get a description of the error. Restarting Apache fixes the problem. Has anyone else experianced the same issue? It appears to me that this is a php oci8 bug. (shouldn't a new connection be built if a persistant connection fails, and if not using persistant connections, shouldn't this be a non issue?) Thanks, Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.8/Oracle 9i OCI call question for BLOBs
[EMAIL PROTECTED] wrote: I'm trying to write text to a BLOB. I got a valid return code but it did not write the BLOB. I was able to use similar code writing to a CLOB. Any examples I've seen for BLOBs are reading from Binary files. Here's how I did the CLOB, but it would not work for BLOB. Is this a bug in PHP? $query = insert into . getSchema() . attf_description . (id, narticid, nordertoprint, vheadertoprint, cldescription ) . values( . $id . , . $articid . , . $ordertoprint . ,' . $headertoprint . ', EMPTY_CLOB()) . returning CLDESCRIPTION into :CLDESCRIPTION; $parsed = ociparse($connection,$query); $clob = OCINewDescriptor($connection, OCI_D_LOB); $bind = OCIBindByName($parsed, $clob_name, $clob, -1, OCI_B_CLOB); ociexecute($parsed, OCI_DEFAULT); $err = $clob-save($clob_data); $committed = ocicommit($connection, OCI_DEFAULT); OCIFreeStatement( $parsed ); Thanks, Kathy BLOB and CLOB handling is similar. Without knowing your failing code I cannot tell what your problem is There is a working BLOB example at: http://forums.oracle.com/forums/thread.jsp?forum=178thread=233174message=664200q=626c6f62#664200 Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple Oracle connections
Chris Back wrote: Hi, I am hoping that someone can help diagnose this issue. I am able to successfully connect to and query a remote Oracle 9.2 database from apache2/php5. However, when I have multiple clients hitting my php scripts, all of which require a connection to the database, problems begin to occur. The first script running gets a connection to the database, start performing queries, etc. While the first connection is running all other pages hang while trying to connect to the database until the first page finishes. I have tried all of the following to no avail: oci_connect, oci_new_connect, and oci_pconnect. The results are always the same, only one connection opens, all others end up waiting. I have found that I can connect to the DB through other methods at the same time (jdbc, sqlplus). Is it possible I have configured something incorrectly or I have the wrong expectations? I could not find anything on the web concerning this issue and I know there must be much higher traffic installations that would have experienced this issue if it was widespread. Any help would be greatly appreciated. -Chris Back Using PHP5 and Apache 2 sounds daring. What platform are you on? If you can track down more information, file a bug at http://bugs.php.net/. Also see http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#conmgt Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How use select for update
Chris wrote: Is row-level locking happening? I think that the lock doesn t work When are you checking the locks? I am checking the lock with an SQLPLUS session If i lock my table with SQLPLUS, PHP can make an select for update But if i try to lock with PHP i can make an other select for update with sqlplus So my lock doesn t work My locks work. In SQL*Plus: select * from emp for update; In a PHP script: $query = 'select * from emp for update nowait'; $stid = OCIParse($conn, $query); $r = OCIExecute($stid, OCI_DEFAULT); The output of the PHP script is: Warning: ociexecute(): OCIStmtExecute: ORA-00054: resource busy and acquire with NOWAIT specified in c:\cj\test.php on line 25 This shows that the rows were locked and not available. Calling the PHP script before the SQL*Plus script has different behaviour. See http://www.orafaq.com/faqphp.htm#TRANS : If one doesn't commit or rollback at the end of a script, PHP will do an implicit commit Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php and oracle
Dieter, Can you share some of your migration experiences? Why did you migrate to Oracle and what problems did you face? Miscellaneous thoughts follow: Regarding the error, search the bdump trace files for 3114 or other ORA-xyz errors. You may need to get Oracle Support involved if there are any. Your trace file dir seems huge. The Administrator's guide has some info about controlling the sizes: http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10739/manproc.htm#sthref655 Effectively you delete what you don't need. Hopefully PHP5 will stabilize quickly. I recall a stern warning in the PHP manual about not using Apache 2. I can't find it currently - anyone know if it has been rescinded? The troubleshooting FAQ mentions restarting Apache occasionally to avoid connection problems. (See http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#conmgt) I feel that the Oracle-PHP community needs to get together and work on through the various connection issues. Anyone want to participate? Chris D.Wilkening wrote: Hi, we are not really trained in analyzing Oracle-logs. I've been using Mysql and Mssql for years, but the migration was more difficult, than I thought. In $ORACLE_HOME/admin/%database% I have Gigabytes of logs, so do not know, where to start... du -sch * 1.5Gbdump 166Mcdump 28K create 8.0Kpfile 282Kudump 1.7Gtotal well, for the apache-problem, I've found an solution (not the straight way, but it seems to work so far): using apache_child_terminate doesn't work (probably apache2 compiled against nptl (linux kernel 2.6), apache_child_terminate doesn't work in an multi-threaded env) so I cought the php-error using set_error_handler. Inside of this error-method, I did an posix_kill(getmypid(),15); I know, I won't win the programmers Nobel-Prize for that crap, but it works so far; dropped connections are reconnected. Dieter Christopher Jones sagte: D.Wilkening wrote: Hi everyone, i've a problem using php with oracle 10g. (php 5.0.1 compiled against Oracle 10.1.0.2-libs, apache2 and apache1) One or two days, everything looks good. Then, by pressing (once a second) reload in your browser, you sometimes get an ERROR #: 2 ERROR DESC: oci_execute() [a href='function.oci-execute'function.oci-execute/a]: OCIStmtExecute: ORA-03114: Nicht mit ORACLE verbunden restarting apache solves the problem, but is no real option. My first idea was the connection pooling, so i tried a ocilogon instead ociPlogon, but the problem dodn't solve. Any Ideas? Thank you in advance Are there any clues in the database trace files? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB Connectivity Problem
Jon Foreman wrote: Does anyone have any suggestions for the following problem: I'm running Apache/1.3.31 and PHP Version 4.3.8 connecting to an Oracle database. Periodically, PHP is unable to connect to the database. When this problem occurs, I am able to connect to the database from the webserver without any problem using SQLPlus. I've also run tcpdump on my database server and I see no incoming requests from the problem web server when I run a PHP page that queries the database. A graceful restart of apache, or simple 'apachectl restart' do not fix the problem. I have to manually stop and start the Apache process and the problem goes away (for a while at least). We are using persistent database connections, but non-persistent ociconnect calls also fail. The number of DB connections is unlimited in the php.ini config. Also, my DB server has plenty of capacity to accommodate many more connections. Thanks, Jon Are you getting any errors? Are the failing connections to the same or different database users? What sorts of load is Apache under? What platform? What kinds of statements are being run (is anything blocking threads/connections etc)? Are you using the oci8 or oracle calls (do both have the problem)? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OCI8
It might be a feature of PHP's connection caching. Why don't you log a bug in the PHP bug DB so the problem can be tracked? Do you really need to keep reconnecting? See http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#conmgt Chris yannick wrote: I have some trouble with Oracle Database and php... see this code: ? while (1) { $conn=OCILogon($username,$password,$database); $stmt=OCIParse($conn,select 50 as toto from dual); OCIDefineByName($stmt,TOTO,$total); OCIExecute($stmt); OCIFetch($stmt); echo :::$total:::\n; OCILogoff($conn); $err=OCIError($conn); OCILogoff($conn); sleep(10); } ? when i execute it, the number of fd on ocius.msg is growing. but there is only 1 connection at database. Can someone help me ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle Client Libraries for Linux
Peter Beckman wrote: How do I get connected from a remote PHP+Apache box to Oracle9i on linux? The current Oracle Instant Client bundle is fine for using PHP on Windows, but does not have headers for compiling PHP with Oracle support on other platforms. An Instant Client SDK with headers is coming soon I'm told, so scenarios like yours will be made a lot simpler. In the meantime, to link with Oracle 9i drivers, download the Oracle9i Database Release 2, run the installer and choose the Client option. Without knowing your hardware, I'd guess along with you that you want the 9.2.0.4 bundle marked Enterprise/Standard Edition for Linux New. For Oracle 10g drivers download the Oracle Database 10g Client Release, run the installer and choose the Administrator option. I'd go with the 10g option. There are some documents (including one on PHP/Oracle/Linux) that may help at http://otn.oracle.com/tech/opensource/index.html Chris Peter Beckman wrote: Folks -- I've been trying to figure out where the Oracle client libraries live, but I'm confused as hell. I've read the PHP-DB archives, and everyone keeps talking about installing the client libraries (libclntsh et al), and how that's all you need for Oracle 9i PHP support. Great -- but which options presented horribly by Oracle do I download? On this page: http://otn.oracle.com/software/products/oracle9i/index.html It lists: Oracle9i Release 2 (9.2.0.4) Oracle9i Database Release 2 Enterprise/Standard Edition for Linux x86-64 New (03-May-04) Oracle9i Database Release 2 Enterprise/Standard Edition for Linux New (26-Mar-04) Oracle9i Release 2 (9.2.0.2) Oracle9i Database Release 2 Enterprise/Standard/Personal/Client Edition for Windows XP 2003/Windows Server 2003 (64-bit) Oracle9i Database Release 2 Enterprise/Standard Edition for HP-UX/IA64 (v9.2.0.2) Oracle9i Database Release 2 Enterprise/Standard Edition for HP Alpha OpenVMS Oracle9i Database Release 2 Enterprise/Standard Edition for Linux/IA64, Release 2 (v9.2.0.2) Oracle9i Release 2 (9.2.0.1) Oracle9i Database Release 2 Enterprise/Standard/Personal/Client Edition for Windows Server 2003 (32-bit) Oracle9i Database Release 2 Enterprise/Standard/Personal Edition for Windows NT/2000/XP Oracle9i Database Release 2 Enterprise/Standard Edition for Sun SPARC Solaris (32-bit) Oracle9i Database Release 2 Enterprise Edition for Sun SPARC Solaris (64-bit) Oracle9i Database Release 2 Enterprise/Standard Edition for HP-UX Oracle9i Database Release 2 Enterprise/Standard Edition for Compaq Tru64 Oracle9i Database Release 2 Enterprise/Standard Edition for AIX Oracle9i Database Release 2 Enterprise/Standard Edition for AIX-Based 5L Systems Oracle9i Database Release 2 Enterprise Edition for Linux/390 Oracle9i Database Release 2 Client for Windows 98/NT/2000/XP Oracle9i Release 2 - Developer's Releases Oracle9i Database Release 2 for IBM Power based Linux New! [01-Dec-03] Oracle9i Developer Release 1 (9.2.0.3.0) for Linux / AMD64 Oracle9i Database Release 2 Enterprise Edition for Apple Mac OS X Version 10.2 Jaguar Oracle9i Release 1 (9.0.1) Oracle9i Release 1 (9.0.1) Enterprise Edition (all platforms) Oracle9i Personal Edition for Microsoft Windows 98 Oracle9i Release 1 - Developer's Releases Oracle9i Enterprise Edition for z/Linux, Release 1 - Developer's Release I'm running Linux RH Enterprise 3 on this server, and the Oracle box is remote. My original assumption is to download the second link, 9iR2 for Linux. However, this is 1.5GB worth of a download for three friggin drivers. What the hell? All of the clients are for Windows, Even the 9.0.1 release is 1.1GB. What do I need to download from Oracle to get the drivers for PHP? Please don't just say go to otn.oracle.com and download the client because I've been there and cannot for the life of me find it. I don't have the ability to display X Windows remotely, so whatever solution has got to be command line. I'm at my wits end! I've installed Instant Client, so I have the 10g libraries: /usr/lib/oracle/10.1.0.2/client/lib -- ll total 109664 drwxr-xr-x2 root root 4096 Jun 14 12:36 ./ drwxr-xr-x4 root root 4096 Jun 14 12:36 ../ -rw-r--r--2 root root 1417242 Feb 23 19:32 classes12.jar -rw-r--r--1 root root 1353 Feb 23 19:32 glogin.sql -rwxr-xr-x2 root root 13347415 Feb 23 19:32 libclntsh.so.10.1* -rw-r--r--2 root root 2838283 Feb 23 19:32 libnnz10.so -rw-r--r--2 root root 969980 Feb 23 19:32 libocci.so.10.1 -rwxr-xr-x2 root root 91345295 Feb 23 19:32 libociei.so* -rw-r--r--2 root root96117 Feb 23 19:32 libocijdbc10.so -rw-r--r--1 root root 759920 Feb 23 19:32 libsqlplus.so
Re: [PHP-DB] Re: Extremely Urgent: Problem with PHP and Oracle
Justin Patrin wrote: Charles Morris wrote: putenv(ORACLE_SID=PROJ); putenv(ORACLE_HOME=/home/oracle9); I have tried putenv myself and it doesn't seem to work for Oracle connections. Putting those in your shell environment, then restarting apache. Check to see if the env vars are set from a PHP script (without using putenv to set them of course). I agree. See http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle syntax
Rafi Sheikh wrote: Hi list. I am a newbie and would like to ask if anyone could give me the proper syntax for connecting with oracle DB. For example with MySQL it is: mysql_connect..., mysql_query... For MS SQL Server: mssql_connect..., mssql_query... There are various examples in the PHP documentation of the oci8 functions at http://www.php.net/manual/en/ref.oci8.php (The oci8 functions are preferred to the older oracle functions) There are a couple of Oracle-PHP FAQ's on http://otn.oracle.com/tech/opensource/index.html. For a specific connection example see http://otn.oracle.com/tech/opensource/php_faq.html#CONNECT Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP - Calling a Oracle 9i procedure
Joshua, I see this is the question asked on http://forums.oracle.com/forums/thread.jsp?forum=178thread=248354tstart=0trange=15 I'll followup on the OTN forum, not to this PHP-DB mail list. Chris Joshua Skagemo wrote: Hi, I am trying to call a procedure in Oracle 9i but I just can't get it to work... My procedure has 5 IN values and return 1 REF CURSOR called :p_cursor When I run my script I just keep getting this error: Warning: OCIFetchInto: ORA-08103: object no longer exists in E:\Intranet\test.php on line 35 which is the while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) { line Please help me with this...I am so stuck... My PHP code looks like this: $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 255.255.0.0)(PORT = 1521)) (CONNECT_DATA = (SID = )) ); $conn = OCILogon(logon, passoword, $db) or die('No Connection'); $curs = OCINewCursor($conn); $query = begin NB_P_TRAILBALANCE(:fromDate, :toDate, :companyCode, :budgetCode, :startYear, :p_cursor); end;; $stmt = OCIParse($conn, $query) or die ('Can not parse query'); ocibindbyname($stmt, :fromDate, $fromDate, -1); ocibindbyname($stmt, :toDate, $toDate, -1); ocibindbyname($stmt, :companyCode, $companyCode, -1); ocibindbyname($stmt, :budgetCode, $budgetCode, -1); ocibindbyname($stmt, :startYear, $startYear, -1);; ocibindbyname($stmt, :p_cursor, $curs, -1, OCI_B_CURSOR); $fromDate = '01/04/04'; $toDate = '30/04/04'; $companyCode = '01'; $budgetCode = '10909'; $startYear = '01/07/03'; ociexecute($stmt); ociexecute($curs); while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) { var_dump($duties); } OCIFreeStatement($stmt); OCIFreeCursor($curs); OCILogoff($conn); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error loading module: Unable to load dynamic library
Philippe wrote: Well, the exact message is: Unable to load dynamic library php_oci8.dll: The specified procedure could not be found If I remove the library the message becomes The specified module could not be found. It seems to be able to find the library (all the paths are correct) but it seems that this php_oci8.dll file is the wrong version or that it is looking for an additional DLL that it can't find OR that it can find the additional DLL but it is the wrong version. If I only knew what DLL was needed! Philippe The common problem would be that php_oci8.dll cannot find Oracle's libraries. Have you elimated this as the problem? There are a coupel of things to try: (i) Check phpinfo() output. Make sure PATH in the Apache env section contains the Oracle bin directory. If this is not clear in my FAQ, please let me know so I can update the FAQ. Currently http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars says: If Apache starts but gives errors about Oracle libraries and/or OCI8 function calls fail, try looking at PHP's environment. Create the following script phpinfo.php where your web server can read it and load it in a browser: ?php phpinfo(); ? Triple-check the environment and path configuration. On UNIX check that LD_LIBRARY_PATH (or equivalent) contains $ORACLE_HOME/lib. On Windows the PATH variable may need to contain %ORACLE_HOME%\bin. (ii) Install http://www.dependencywalker.com/ and run it on php_oci8.dll I'll look into adding a comment about this utility in the next FAQ update. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error loading module: Unable to load dynamic library 'c:\tools\php\extensions\php_oci8.dll' - The specified procedure could not be found
Philippe wrote: Hi, I am experiencing the message in the title of this message when starting or restarting Apache. I have the following configuration: - Windows XP - Apache 2.0.49 - PHP 4.3.6 - Oracle Client 8i If anyone has any information as to why this is happening and how I can solve it, I would be very grateful. Thanks. There might be something in http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html that helps. Does your Oracle 8i DB work OK on XP independent of PHP? I forget when/if this combo was certified. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error loading module: Unable to load dynamic library
The error sounds like an environment problem. Check phpinfo() to see what paths are being used - see the FAQ. Chris Philippe wrote: Thanks for your quick reply, Chris. My oracle 8i client setup does work on XP independently of PHP. I can connect to Oracle using PERL, ODBC, Java as well as a database management tool called Aqua Data Studio which uses native connections. Christopher Jones wrote: Philippe wrote: Hi, I am experiencing the message in the title of this message when starting or restarting Apache. I have the following configuration: - Windows XP - Apache 2.0.49 - PHP 4.3.6 - Oracle Client 8i If anyone has any information as to why this is happening and how I can solve it, I would be very grateful. Thanks. There might be something in http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html that helps. Does your Oracle 8i DB work OK on XP independent of PHP? I forget when/if this combo was certified. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP's Oracle interface
Joseph Burch wrote: Foolks - In building the Apache PHP-Oracle interface we have discovered a discrepancy between the functions listed in the PHP on-line documentation and the function list obtained by nm for libphp4.so. Our UNIX Solaris build comprises Apache_1.3.29, PHP-4.3.4, and the full Enterprise edition of Oracle 9.2.0.1.0. For example, we see the function reference in the PHP documentation for oci_connect() but find no function by that name in the build. Rather, we see oci_do_connect() instead. Current PHP document seems to be describing features of an Oracle interface that simply are not available. Has anyone run onto this or similar problems? Thanks, Joseph Burch ITC-UNIX Systems University of Virginia To connect to Oracle in PHP 4, the old name OCILogon() can be used. Check PHPs oci8.c source code for all names and aliases. There is some flux in function names at the moment and the manual may or may not be correct. I believe placeholder manual entries for recently obsoleted names were going to be created. The name changes seem to have been triggered by the general PHP discussion of naming conventions and the desire in PHP 5 to use similar names to other DB interfaces. See http://bugs.php.net/bug.php?id=27676 Also see http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#upgphp5 Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: ocilogon error
Justin Patrin wrote: Adam Williams wrote: Hi, I have oracle and PHP working together on a remote server called zed that runs redhat linux. I have another computer called accessserver that runs win2k pro with PHP that I am trying to connect to oracle on zed. Both computers have the oracle client libraries installed. On accessserver I have the code: ?php $conn = ocilogon(user,pw,zed.aleph0) or die .ora_error(); if ($conn) { echo connection to oracle successful; } ? When I run this I get the error: Warning: ocilogon(): OCISessionBegin: ORA-12705: invalid or unknown NLS parameter value specified in C:\htdocs\oracleconnect.php on line 2 I've tried looking on google for the NLS parameter but I'm not having much luck. Anyone able to help? Thanks! You probably need to set up some environment vars. Here's the ones I have set: export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 export ORA_NLS33=/usr/lib/ora/ocommon/nls/admin/data export ORA_NLS=/usr/lib/ora/ocommon/nls/admin/data export ORACLE_HOME=/usr/lib/ora export ORACLE_BASE=/usr/lib Fix the paths, put those in your env, then restart apache and see if you still have the problems. Yes, correctly setting the ORACLE_HOME, NLS_LANG and maybe ORA_NLS33 variables will probably resolve it. I'm not aware of any OCI-runtime need for ORACLE_BASE. For completeness, ORA_NLS is used with Oracle 7.2 client libraries, ORA_NLS32 with Oracle 7.3, and ORA_NLS33 with Oracle 8 and 9. With Oracle 10g the variable is ORA_NLS10. From about Oracle 7.3 onwards ORA_NLSxx should default correctly. It may not be needed with a basic Oracle installation. On Windows I guess it's possible to have an environment variable and registry clash. There is a string in %ORACLE_HOME%\bin\oracle.key. Use this string as the registry hierarchy to check. If you have Oracle Metalink access there is a whole article discussing the causes of ORA-12705 (ORA-12705 - Common Reasons and How to Resolve Them, Article #158654.1). Causes include invalid values for NLS_LANG, an incorrect directory specified in ORA_NLSxx, lack of read permissions on the %ORACLE_HOME%\ocommon\nls\admin\data directory (this is the directory that ORA_NLS33 should generally be set to), and an invalid ORACLE_HOME specified in Oracle Net's listener.ora file. Once specific mention of ORA-12705 is made in the newly updated Oracle PHP Troubleshooting FAQ (http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html) but this doesn't sound like your scenario. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle/PHP Instant-Client ( remote connection )
Comments below. Jim Morrison wrote: Hello all, Hope this isn't an FAQ - have trawled google, otn.oracle, php.net etc - not sure I can find the answer.. I've been using phpmySql for a while now and getting on great - however I'm now tasked with getting my php to talk to a _remote_ ( right next to me but separate ) Oracle server... I found on otn.oracle.com a thing called 'instantclient' - a couple of .rpm's to install what is supposed to be a kinda plug-and-play Linux Oracle client.. However, I can't seem to be able to compile PHP with Oracle support, because I don't think instantclient has the required header files to compile PHP/OCI8 .. Is that right? The other solution I thought might be to use instantclient itself.. .. It comes with a couple of .so's, so I've tried DynamicallyLoading them at the top of a php page.. It seems to be loading the one I give it (libociei.so) but then complains that it can't find libclntsh.so.10.1 which I have, and is sitting right next to libociei.so .. ( The error is : Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/extensions/libociei.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in /path/to/info.php on line 2 .. And /usr/local/lib/php/extensions/libclntsh.so.10.1 does exist ) Thought that maybe I've just got a path problem..?? Anyway - is the 'ONLY' solution to getting PHP to connect remotely to an Oracle server to download 1.5Gb's of Oracle CD's? Has anyone had any experience getting instantclient/php to work? Is there any way I can get the headers I need to compile --with-oci8 without the 1.5Gb download?? The download of the traditional Client Release is under 400M. Am I missing something blatantly obvious? Any advice/points-in-the-right-direction would be much appreciated, Thanks, Jimbo What exactly have you configured? Do you have LD_LIBRARY_PATH set? I'm using Instant Client with PHP on Linux and a pre-release Instant Client on Windows. I'm starting to put together some notes for http://otn.oracle.com/tech/opensource/index.html Instant Client doesn't yet come with headers for compiling (the statement I've read is that an SDK is under investigation). To get the headers I chose the Administrator install option in the Oracle Database 10g Client Release 1 (10.1.0.2) for Linux x86 release. I compiled PHP with this first. I then reran the same installer and chose the Instant Client option. This installed into non-system directories (unlike the Instant Client RPM from OTN). I configured PHP to use Instant Client by setting LD_LIBRARY_PATH to the new library directory, and unsetting ORACLE_HOME before starting Apache. For PHP you only need libociei.so, libnnz10.so and libclnts.so.10.1 from the Instant Client package. If re-compiling won't be needed, you can copy these libs to a directory of your choice and deinstall Oracle to save disk space. On Windows you can drop Instant Client straight onto the prebuilt PHP binaries. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] getting BLOBS (ORACLE) back to filesystem
Elke Stahl wrote: i successfully stored blobs in an oracle table via php. but it seems to be impossible getting them back to filesystem! It is a binary (no picture or executable) which arives via mail and is written into a unix-filesystem. ive stored this binary as blob datatype together with other informations in a table with the help of a php-script. afterwards the binary will be deleted from filesystem. If the binary is to be used again, it should be read out of the database and written back into the unix-filesystem. I need a solution for the last part. Maybe something like: $query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = '.MYBLOBID; $stmt = OCIParse ($conn, $query); OCIExecute($stmt, OCI_DEFAULT); OCIFetchInto($stmt, $arr, OCI_ASSOC); $result = $arr['BLOBDATA']-load(); $fh = fopen('c:/temp/sometempfile.pdf', 'wb'); fwrite($fh, $result); fclose($fh); Depending how the file is to be used, maybe it is worth checking whether it really needs to be written back to the filesystem. For example files stored in Oracle 9i can be accessed directly by a URL. Another example: the PL/SQL UTL_SMTP package could be used to mail it. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP5B5 + Oracle9i + Apache1.3
Josef Suchanek wrote: my platform is W2K or WXP. For the first I tried Apache 1.3.22 included in Oracle 9i installation with bad result. Then I tested Apache 1.3.29 with the same bad result. Then I tried IIS without problem and last test was with Apache 2.0.48. It worked fine too. What about logging a PHP bug? When I tested apache 1.3.xx without oci8 module web server started and worked well but when I uncommented oci8 module then apache crashed in all cases. All binaries was downloaded directly from apache.net without my recompilation. Can you try the latest PHP5 snapshot from snaps.php.net? If you log a bug the maintainers will want this. Bad think is that there are two web server releases on computer. That's all. I have 1.3.28 and 2.0.47. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP oracle 9.2
Delfins wrote: i have successfully installed Oracle 9.2 on Slackware 9.0 database works fine also any other applications runs ok. but when i compiled PHP5 with OCI8 (path i was specified as ORACLE_HOME) but running some scrip, i have this error : Warning: ocilogon(): _oci_open_server: Error while trying to retrieve text for error ORA-12154 There is some information in: http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars The error you are getting is mentioned part way down in that section. A google search especially in recent google groups postings may pick up other causes, problem investigation tips, and solutions. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle + PHP
Luis Moran Ochoa wrote: I've build the typical script for starting apache, it's like this: $ORACLE_HOME=blablahblah... more oracle variables Are the environment variables exported in the script?: ORACLE_HOME=/my/oracle/home export ORACLE_HOME Are all variables needed set? Are there any permission problems accessing the Oracle home directory during the boot process? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle + PHP
Perhaps something that isn't obvious is missing. If you post more detail (e.g. the exact script and the exact permissions) someone might be able to help you. Chris Luis Moran Ochoa wrote: Yes they are... I tried to put them into the httpd.conf file, like: SetEnv ORACLE_HOME /usr/oracle and so The problem still remains. Too, I've put all the environment variables in the root env into the script I thought it can be a problem with a missed variable But it doesn't work neither. root user's environment was the same that the one defined into the script, and it doesn't work neither. I don't know what more tests to do I check the permissions too They appear to be right. I'm completely lost Christopher Jones wrote: Luis Moran Ochoa wrote: I've build the typical script for starting apache, it's like this: $ORACLE_HOME=blablahblah... more oracle variables Are the environment variables exported in the script?: ORACLE_HOME=/my/oracle/home export ORACLE_HOME Are all variables needed set? Are there any permission problems accessing the Oracle home directory during the boot process? Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: [PHP] Oracle + PHP
What's the exact error you get when you try to connect to oracle and what command are you using to connect? Does a phpinfo() script show the Oracle env vars correctly under the Environment section? Chris Luis Moran Ochoa wrote: These are the exact details... /usr/oracle permissions 750 owner oracle.oinstall apache belongs to oinstall. script permissions in /etc/init.d/apache -- 755 ORACLE_SID=OWEB ;export ORACLE_SID; ORACLE_HOME=/usr/oracle/product; export ORACLE_HOME; TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN; ORACLE_BASE=/usr/oracle; export ORACLE_BASE; ORA_NLS33=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS33; ORA_NLS=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS; NLS_LANG=spanish_spain.we8dec; export NLS_LANG; TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN; CLASSPATH=:/usr/local/jre:/usr/oracle/product/jdbc/lib/classes111.zip: export CLASSPATH; LD_LIBRARY_PATH=/usr/oracle/product/lib:/usr/oracle/product/jdbc/lib: export LD_LIBRARY_PATH case $1 in start) /opt/apache/bin/apachectl startssl;; stop) /opt/apache/bin/apachectl stop ;; esac But the problem is the next: When I login as root (on a console or an xterm) and run that script (/etc/init.d/apache start) everything works fine. So I've created a link from /etc/rc5.d/S99apache to /etc/init.d/apache for starting it during boot process.. But when I reboot the system and apache is started on boot (oracle is launche thru S20oracle), it start. If you request a php page or other kind of webpage it works fine, until you request a php page that connects to oracle Then the instance that is serving that request dies, raise an error that says something like Couldn't connect to database and no more php+oracle pages can be requested... But php and apache still works. If I stop apache and launch it again from console using /etc/init.d/apache start It works again and works fine, all connections are successfull. User apache belongs to oinstall group and have read and execution access to all the oracle directories. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.4 ADODB Oracle 9.2
William Cheung wrote: All the system errors are solved. However, the query seems not returning any rows. I got undefined index error on any query returns. Am I hitting the brick wall? Do PHP and ADODB work with Oracle 9.2? Are there anyone know the answer? I am using Windows 2K, IIS and Oracle. The script below works for me with W2K, Apache 1.3, PHP 4.3.3 (and 4.3.5RC1) and ADOdb 4.10. Chris - ?php require_once(adodb.inc.php); define(ORA_CON_UN, hr); define(ORA_CON_PW, hr); define(ORA_CON_DB, ); function error($w, $m) { echo $w: $m; die; } $db = ADONewConnection(oci8); if ([EMAIL PROTECTED]Connect(false, ORA_CON_UN, ORA_CON_PW, ORA_CON_DB)) error('Error connecting', $db-ErrorMsg()); if (!$rs = $db-Execute(SELECT * FROM DUAL)) error('Error selecting', $db-ErrorMsg()); $row = $rs-FetchRow(); echo pre; var_dump($row); echo /pre; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP 4.3.4, ADODB and Oracle9.2
William Cheung wrote: Win 2K server IIS 4.0 PHP 4.3.4 ADODB 4.10 Oracle 9.2 I got the following error Warning: ociplogon():_oci_open_server: Error while trying to retrieve text for error ORA-12538 in C:\PHPRoot\ADODB\drivers\adodb-oci8.inc.php on line 128 You might be hitting a combination of problems. I noticed the message Error while trying to retrieve text. This means that your ORACLE_HOME is not set properly somewhere, and after the ORA-12538 occurs Oracle can't look up actual text for it. Other, more important things are likely to fail if the environment is not set properly. There's a note about the environment variables and Apache in the Oracle/PHP troubleshooting FAQ: http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars It might give some background that applies to IIS too. As to why the ORA error occurs - I'm not sure yet. I've seen ORA-12538 with ADOdb 4.10 in scripts that work with ADOdb 3.60. See http://phplens.com/lens/lensforum/msgs.php?id=8330 Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Stored Procedures ?
Ricardo Lopes wrote: Is possible to call database stored procedures from php with oracle or any other db? There is a complete Oracle example in Frank Naudé's Oracle/PHP FAQ: http://otn.oracle.com/tech/opensource/php_faq.html#PROC Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] connect nativly with Oracle9i
nabil wrote: I have php 4.3.4 on windows as a development environments, i could not connect to oracle using the native functions, What error do you get? should i connect using ODBC ?? OCI8 has some benefits, depending on what you want to do now and/or in the future. What are you trying to do? What will be happen when i will deploy on Linux ? still same ? That depends what the problem was. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oracle compilation with php
I see the answer has already been given on php-install. A suggestion which hasn't been made is to use PHP's new oci8 interface in preference to the old one called oracle whenever possible. To quote from a note on Oracle's PHP forum (see http://forums.oracle.com/forums/forum.jsp?forum=178 ) There are several reasons why I'd want to use PHP's OCI8 instead of ora_ calls: better Oracle behavior, performance and support, ability to use LOBs, and perhaps OCI8 is more widely used with better PHP support and examples. Chris Douglas B. Jones wrote: Hi, (I also posted this to php-install this morning, but decided to see if I might get some more help in this group - sorry for any cross postings.) We are on Tru64 5.1 and I am trying to compile php 4.3.4. I get the following error: cc: Severe: /src/net/www/php-4.3.4/ext/oracle/php_oracle.h, line 23: Cannot find file ocidfn.h specified in #include directive. (noinclfilef) #include ocidfn.h -^ I cannot find this include file anywhere in the oracle installation or the php installation. The oracle version is 9.2.0.1.0. I have also try oci8, but no luck there either - it can't find oci.h. Thanks for any help. Cheers, Douglas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oracle compilation with php
Douglas, To try and reduce confusion, a Client install refers to the option of that name in the Oracle9i Database Release installer. (The other options are Database, Mgt Intg, and Cluster Mgt). This will install the headers needed to link PHP, if your previous installer choice didn't load them. The Oracle/PHP/Linux install notes at http://otn.oracle.com/tech/opensource/php/apache/inst_php_apache_linux.html skim over this but otherwise might have some info that is helpful and applicable to Tru64. Chris Michael Mauch wrote: Douglas B. Jones wrote: I did not see an answer on php-install. http://lists.php.net/article.php?group=php.installarticle=12457 I have also tried oci8, but I get the error mentioned at the bottom of my post. I have the ORA_HOME set, both on the shell level and the makefile level. It's ORACLE_HOME, not ORA_HOME. You have to set and export it in the shell. I look under the ORA_HOME root with 'find ORA_HOME -name oci.h -print', and I get nothing. When I look for all headers, '*.h', I get none of the ones missing for php oci8 or oracle options. Thanks for the quote below, I will then want to look more to the oci8 calls then. Unfortunately, neither oci8 or oracle php option let me compile, due to the respective missing header files. Yes, Oracle's installer is fun. Regards... Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php