Re: [PHP-DB] oci_connect returns warning if provided with the 4th param(charset)

2008-12-24 Thread Tonado
Hi  Chris,

 Thank you very much for the info. I found that there wasn't a library 
called 'libociei.so' on my server compared with the lastest Oracle Instant 
Client. I copied it to my server and then I found oci_connect(,,,'UTF8') 
worked!   I didn't know why but I thought you were right that my prior OCI 
just supported a restricted set of character set. Thank you very much!

Regards,
Tonado

"Christopher Jones"  
??:49500cc3.8090...@oracle.com...
>
> 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] oci_connect returns warning if provided with the 4th param(charset)

2008-12-22 Thread Chris

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.


Try 'AL32UTF8'.

The oracle db has to be set up to allow those sort of chars too when you 
create it, you can't convert it (everything I found says you have to do 
a dump/recreate the db/import the data).


http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm

--
Postgresql & php tutorials
http://www.designmagick.com/


--
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)

2008-12-22 Thread Christopher Jones


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] oci_connect

2008-11-20 Thread Fred Silsbee
IT WORKS!

in the file /etc/rc.d/init.d/httpd

I inserted statements starting with export position indicated by the 
surrounding code.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
# new statements here
export ORACLE_HOSTNAME=localhost.localdomain
export TNS_ADMIN=/u01/app/oracle/product/11.1.0/db_1/network/admin
export ORACLE_BASE=/u01/app/oracle

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

# new statements above

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}


















--- On Fri, 11/21/08, Christopher Jones <[EMAIL PROTECTED]> wrote:

> From: Christopher Jones <[EMAIL PROTECTED]>
> Subject: Re: [PHP-DB] oci_connect
> To: [EMAIL PROTECTED]
> Date: Friday, November 21, 2008, 12:56 AM
> Unfortunately this is not the section titled
> "Environment".
> 
> I'm hopping on a flight and will almost certainly
> not be able to read email until the end of next week.
> 
> Please follow my suggestion in the post below about setting
> variables.
> 
> Chris
> 
> Fred Silsbee wrote:
> > Apache Environment
> > VariableValue
> > ORACLE_HOSTNAME localhost.localdomain
> > TNS_ADMIN
>   /u01/app/oracle/product/11.1.0/db_1/network/admin
> > ORACLE_BASE /u01/app/oracle
> > ORACLE_HOME /u01/app/oracle/product/11.1.0/db_1
> > ORACLE_SID  lmkiiiGDNSID
> > ORACLE_TERM xterm
> > LD_LIBRARY_PATH
>   /u01/app/oracle/product/11.1.0/db_1/lib:/lib:/usr/lib
> > HTTP_HOST   localhost:8080
> > HTTP_USER_AGENT Mozilla/5.0 (X11; U; Linux i686;
> en-US; rv:1.9.0.4) Gecko/2008111217 Fedora/3.0.4-1.fc9
> Firefox/3.0.4
> > HTTP_ACCEPT
>   text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > HTTP_ACCEPT_LANGUAGEen-us,en;q=0.5
> > HTTP_ACCEPT_ENCODINGgzip,deflate
> > HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > HTTP_KEEP_ALIVE 300
> > HTTP_CONNECTION keep-alive
> > PATH/sbin:/usr/sbin:/bin:/usr/bin
> > SERVER_SIGNATUREApache/2.2.9 (Fedora)
> Server at localhost Port 8080
> > SERVER_SOFTWARE Apache/2.2.9 (Fedora)
> > SERVER_NAME localhost
> > SERVER_ADDR 127.0.0.1
> > SERVER_PORT 8080
> > REMOTE_ADDR 127.0.0.1
> > DOCUMENT_ROOT   /var/www/html
> > SERVER_ADMIN[EMAIL PROTECTED]
> > SCRIPT_FILENAME /var/www/html/phpinfo.php
> > REMOTE_PORT 56423
> > GATEWAY_INTERFACE   CGI/1.1
> > SERVER_PROTOCOL HTTP/1.1
> > REQUEST_METHOD  GET
> > QUERY_STRINGno value
> > REQUEST_URI /phpinfo.php
> > SCRIPT_NAME /phpinfo.php 
> > 
> > 
> > --- On Thu, 11/20/08, Christopher Jones
> <[EMAIL PROTECTED]> wrote:
> > 
> >> From: Christopher Jones
> <[EMAIL PROTECTED]>
> >> Subject: Re: [PHP-DB] oci_connect
> >> To: [EMAIL PROTECTED]
> >> Date: Thursday, November 20, 2008, 5:15 AM
> >> Fred Silsbee wrote:
> >>> what information did you request???
> >> See the sentence in my previous post that ends in
> a
> >> question mark.
> >>
> >> Chris
> >>
> >>>
> >>> --- On Thu, 11/20/08, Christopher Jones
> >> <[EMAIL PROTECTED]> wrote:
> >>>> From: Christopher Jones
> >> <[EMAIL PROTECTED]>
> >>>> Subject: Re: [PHP-DB] oci_connect
> >>>> To: [EMAIL PROTECTED]
> >>>> Cc: php-db@lists.php.net
> >>>> Date: Thursday, November 20, 2008, 1:57 AM
> >>>> 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 

Re: [PHP-DB] oci_connect

2008-11-19 Thread Daniel Brown
On Wed, Nov 19, 2008 at 8:15 PM, Fred Silsbee <[EMAIL PROTECTED]> wrote:
[snip!]

"Fred,"

Please keep all of your posts in the same thread with the same
subject.  You're making it very difficult for others to follow along
with your ramblings, and seem to even be confusing yourself a bit.
Chris has been trying to get the information he needs from you, but it
looks like you're running over yourself.  It happens with frustration,
I completely understand.  ;-P

Keep everything in one thread so that it's easy to follow and so
that Chris and others can help you out.  Once you get the information
sorted out in one linear fashion, I think you'll find the problems
aren't as serious as you might have thought.  And if they are, then we
can all help you to solve them.

-- 

http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
Ask me about our current hosting/dedicated server deals!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] oci_connect

2008-11-19 Thread Christopher Jones



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] oci_connect still not working...I added a debug statement

2008-11-17 Thread Chris



oci_internal_debug(1); // turn on tracing
// Create a database connection



// $conn = oci_connect("hr", "hr", "//dwlin165.us.oracle.com/lmkiiiGDNSID");


That definitely won't work..


// $conn = oci_connect('hr', 'hr',$db);


try
oci_connect('hr', 'hr', '//localhost/xe');

I assume you unlocked the 'hr' account?

See page 35 of 
http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf


--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php