what the php guys need to do
what the php guys need to do
am 18.11.2008 20:23:20 von Fred Silsbee
provide some detailed instructions for oc8/linux install that leave no gaps
instructions that work for newbies
I've never heard of :
# LD_PRELOAD
# NLS_LANG
For example:
You should install OCI8 by yourself. Here is how:
1) Do this as user oracle: cd /tmp; pecl bundle oci8. The output should look like this:
-bash-3.00$ cd /tmp
-bash-3.00$ pecl bundle oci8
downloading oci8-1.3.4.tar ...
Starting to download oci8-1.3.4.tar (Unknown size)
........................................................done : 1,053,184 bytes
Package ready at '/tmp/oci8'
-bash-3.00$
Then, still as "oracle", do the following:
cd /tmp/oci8
phpize
The output will look something like this:
-bash-3.00$ cd /tmp/oci8
-bash-3.00$ phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
-bash-3.00$
If you now take a look at the directory, you will see the "configure" script. Run it as "oracle" because it needs the ORACLE_HOME environment variable. That will produce an output that
should look like this:
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
-bash-3.00$
After that, still as "oracle", you should run "make". The output should look like this:
.......
/bin/sh /tmp/oci8/libtool --mode=link gcc -DPHP_ATOM_INC -I/tmp/oci8/include -I/tmp/oci8/main -I/tmp/oci8 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/ORACLE/app/oracle/product/client/rdbms/public -I/ORACLE/app/oracle/product/client/rdbms/demo -I/ORACLE/app/oracle/product/client/plsql/public -DHAVE_CONFIG_H -g -O2 -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/oci8/modules oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo -Wl,-rpath,/ORACLE/app/oracle/product/client/lib -L/ORACLE/app/oracle/product/client/lib -lclntsh
gcc -shared .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o -L/ORACLE/app/oracle/product/client/lib -lclntsh -Wl,-rpath -Wl,/ORACLE/app/oracle/product/client/lib -Wl,-soname -Wl,oci8.so -o .libs/oci8.so
creating oci8.la
(cd .libs && rm -f oci8.la && ln -s ../oci8.la oci8.la)
/bin/sh /tmp/oci8/libtool --mode=install cp ./oci8.la /tmp/oci8/modules
cp ./.libs/oci8.so /tmp/oci8/modules/oci8.so
cp ./.libs/oci8.lai /tmp/oci8/modules/oci8.la
PATH="$PATH:/sbin" ldconfig -n /tmp/oci8/modules
After that, you should switch to the "root" user and run "make install. Here is the output:
-bash-3.00$ su
Password:
Terminal type is vt100.
Erase is backspace.
Kill is control-X (^X).
root@oracle23 oci8# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
root@oracle23 oci8#
Now, you should adjust the value of "extension_dir" php.ini parameter to point to that
directory, check that you have something like extension=oci8.so in your php.ini and restart your Apache server. Voila, you are done.
I have 11g1 enterprise on Fedora 9 and wonder why I need oracle instant client....maybe just to make it work! Baloney
OTN Forum is loaded with post about not being able to connect!
The following does not work on my computer Fedora 9
$db = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = LMKIIIGDNSID)
)
)";
if ($conn=oci_connect('hr', 'hr', $db))
{
echo "Successfully connected to Oracle.\n";
// OCILogoff($conn);
}
else
{
$err = OCIError();
echo "Oracle Connect Error " . $err['message'];
}
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: what the php guys need to do
am 18.11.2008 21:11:50 von Christopher Jones
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: christopher.jones@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd 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: what the php guys need to do
am 18.11.2008 22:36:37 von Christopher Jones
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 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/hrpwd@LMKIIIGDNSID
then use
$c = oci_connect("hr", "hrpwd", "LMKIIIGDNSID");
Chris
--
Email: christopher.jones@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd 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: what the php guys need to do
am 19.11.2008 00:46:15 von Christopher Jones
I'm CCing php-db again.
Fred Silsbee wrote:
> This worked:
>> sqlplus hr/hr@LMKIIIGD
> 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/hrpwd@LMKIIIGDNSID
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
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: christopher.jones@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd 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: what the php guys need to do
am 19.11.2008 01:12:19 von Fred Silsbee
sorry I forgot last time to cc PHP-DB
> Fred Silsbee wrote:
> > This worked on the command line:
> >> sqlplus hr/hr@LMKIIIGD
>
> > so I tried: (it didn't work)
>
> > if ($conn=oci_connect('hr', 'hr','//localhost/LMKIIIGD'))
>
yes this suggestion is clear and I've tried dozens of combinations
>
> Since you have a different password and SID, your code
> would be:
>
> $c = oci_connect("hr", "hr", "LMKIIIGD"); tried this too!
tried this too.
>
> 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.
How do I tell what the Apache environment is? I tried setting environment variables in hrrpd.conf
>
> Also, running
>
how do I run this?
>
> phpinfo();
> ?>
I did do http://localhost:8080/phpinfo.php
I already did this:
> 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)
--- On Tue, 11/18/08, Christopher Jones wrote:
> From: Christopher Jones
> Subject: Re: [PHP-DB] what the php guys need to do
> To: fredsilsbee@yahoo.com, "PHP DB"
> Date: Tuesday, November 18, 2008, 11:46 PM
> I'm CCing php-db again.
>
> Fred Silsbee wrote:
> > This worked:
> >> sqlplus hr/hr@LMKIIIGD
>
> > 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/hrpwd@LMKIIIGDNSID
> 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
>
>
> 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: christopher.jones@oracle.com Tel: +1 650 506
> 8630
> Twitter: http://twitter.com/ghrd 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: what the php guys need to do
am 19.11.2008 01:27:22 von Fred Silsbee
looking at the results of phpinfo, I have :
/etc/php.ini
with display_errors = On
I get :
OCI8 DEBUG: OCINlsEnvironmentVariableGet at (/tmp/oci8/oci8.c:1819)
OCI8 DEBUG L1: Got NO cached connection at (/tmp/oci8/oci8.c:1864)
OCI8 DEBUG: OCIEnvNlsCreate at (/tmp/oci8/oci8.c:2768)
OCI8 DEBUG L1: create_spool: (0) at (/tmp/oci8/oci8.c:2686)
Oracle Connect Error
using this and 10000 other combinations:
the OCI8 section of php.ini is:
oci8
OCI8 Support enabled
Version 1.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 support enabled
Directive Local Value Master Value
oci8.connection_class no value no value
oci8.default_prefetch 100 100
oci8.events Off 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_connect Off Off
oci8.statement_cache_size 20 20
--- On Tue, 11/18/08, Christopher Jones wrote:
> From: Christopher Jones
> Subject: Re: [PHP-DB] what the php guys need to do
> To: fredsilsbee@yahoo.com, "PHP DB"
> Date: Tuesday, November 18, 2008, 11:46 PM
> I'm CCing php-db again.
>
> Fred Silsbee wrote:
> > This worked:
> >> sqlplus hr/hr@LMKIIIGD
>
> > 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/hrpwd@LMKIIIGDNSID
> 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
>
>
> 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: christopher.jones@oracle.com Tel: +1 650 506
> 8630
> Twitter: http://twitter.com/ghrd Free PHP Book:
> http://tinyurl.com/f8jad
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php