Version of OCI8 and Oracle Instant Client - php

I've got:
Red Hat Enterprise Linux Server release 7.4 (Maipo)
PHP 5.4.16
Apache/2.4.6 (Red Hat Enterprise Linux)
Oracle12c DataBase
What version of OCI8 and Oracle Instant Client should I use?
Thanks a lot!

For PHP 5.2, 5.3, 5.4, 5.5 and 5.6 use the latest PHP OCI8 2.0 you can. Currently the most recent is 2.0.12 on https://pecl.php.net/package/oci8. Use 'pecl install oci8-2.0.12' to install it.
If your database is on a remote machine use Instant Client 12.2. Oracle Database supports client-to-server library version interoperability so you can use older or new Oracle client versions, if necessary. The latest client (12.2) has some improvements - of course!
If your database is on the same machine that PHP is on, you don't need Instant Client.

Related

Connect to multiple versions of Oracle DB with PHP PDO_OCI

i need a ubuntu 20.04 server with php 7.4 to connect multiple version of oracle databases.
i installed the oracle instantclient in version 18.3 and load the oci8 php module.
for new version of oracle databases this works great. for older the connection failed.
these instantclient version is installed:
ii oracle-instantclient18.3-basic 18.3.0.0.0-4 amd64 Oracle Instant Client Basic package
ii oracle-instantclient18.3-devel 18.3.0.0.0-4 amd64 Development headers for Instant Client.
ii oracle-instantclient18.3-jdbc 18.3.0.0.0-4 amd64 Supplemental JDBC features for the Oracle Instant Client
ii oracle-instantclient18.3-odbc 18.3.0.0.0-4 amd64 Oracle Instant Client ODBC
this is the php version:
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS
basically this version have to be supported:
oracle db 9.2.0.6.0
oracle db 9-0.1.3.1
oracle db 11g 11.2.0.1.0
oracle db 12c 12.2.0.1.0
oracle db 19c 12.2.0.3
oracle db 19c 19.0.0.0.0
this is the current code:
<?php
$dbstr ="(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =<SERVERNAME>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = <SRVNAME>)))";
if(!#($conn = oci_connect('<user>','<pass>',$dbstr)))
{
print_r(ocierror());
die("Connect Error");
}
?>
is it possible? i need some hint how to realize this
Oracle 9.0.1 is old. Like "gosh, look how many floppies this comes on" old. And it was a release that was pretty quickly desupported in favor of Oracle 9.2.
If you look at the Client/ Server Interoperability Matrix (Metalink account required), you have to go down to the extended matrix because the summary matrix doesn't even include 9.0.1 any longer. There, you'll see that the last version of the Oracle client that was compatible with a 9.0.1 database was 10.1.0. I'm pretty sure that predates the Oracle Instant Client so you'd probably need to install the full 10.1 client. You'll probably need to put in a support request to get access to versions of the client that old-- Oracle generally doesn't bother to make links to something that old available.
Assuming you do get a version of the client that is sufficiently ancient, it was certainly not certified on the version of Ubuntu or PHP you're using. It might install and work just fine. You might need to go with earlier versions of both.
I would strongly suggest going back to whatever lead to these requirements to make really, really sure that they understand the costs of supporting 20 year old software. If someone told you to build a new web site and to make sure that it was compatible with Firefox 2 (released in 2006), you'd point out that there would be pretty significant costs to trying to support a 15 year old browser doing so for very little gain-- there aren't a lot of Firefox 2 browsers left in the world. Oracle 9.0.1 is 5 years older than that and there are very, very few folks still running that version left in the world.

oci8, php7 and Oracle 10.1 compatibility

I have to upgrade a system from php5.6 to php7.2. The system uses an oracle 10.1 database.
Now I tried to collect all infos but am still confused about the compatibility between php, oci8, instant client and the database.
I read, that with php7 I have to at least install oci8 2.1, but this doesn't work with oracle 10.1.
Is that correct?
Or is it possible to run php7 with oracle 10.1?
Please enlighten me :)
I read, that with php7 I have to at least install oci8 2.1, but this doesn't work with oracle 10.1.
Is that correct?
No. From the manual:
OCI8 2.0 requires Oracle 12c, 11g or 10g client libraries and will install on PHP 5.2 onwards.
Note that the Oracle client version you use doesn't need to match the server version. From the same manual page (reformatted into bullet points for ease of reading):
If OCI8 uses 9iR2 client libraries, then PHP can connect to Oracle Database 8i, 9iR2, 10g or 11g.
If OCI8 uses 10gR2 client libraries, the database can be 9iR2, 10g, 11g or 12c.
If OCI8 uses 11g client libraries, the database can be 9iR2, 10g, 11g or 12c.
If OCI8 uses 12c client libraries, the database can be 10gR2, 11g or 12c.
So only the last scenario (12c client libraries) requires a database version greater than 10.1.
Regardless of what the manual says, I would strongly recommend building a test instance and seeing if you have any issues.
Edit:
Further information from the OCI8 package PECL page:
Oracle's standard cross-version connectivity applies. For example,
PHP OCI8 linked with Instant Client 11.2 can connect to Oracle
Database 9.2 onward. See Oracle's note "Oracle Client / Server
Interoperability Support" (ID 207303.1) for details.

Unable to connect to Cassandra after upgrade to 3.0.0

I've upgraded Cassandra to 3.0.0 some minutes ago through apt-get upgrade (on Ubuntu Linux 14.04 LTS) and after installation and restarting I could connect to my keyspaces using the cqlsh tool and all was ok but when I tried to connect using the DataStax PHP Driver the first time I got "All connections on all I/O threads are busy" but now I get "No hosts available for the control connection". Connection data are the same, so 127.0.0.1 and the default port 9042, I didn't change nothing in configuration. I've tried to downgrade Cassandra to 2.2.3 but after installation it doesn't complete the start sequence. Is this a bug, of Cassandra or of PHP Driver?
There are any ways to restore it without lost datas (with 3.0 or lower version)?
Edit: Version 3+ is not supported. Not even their enterprise version supports Cassandra 3+: Compatible versions of DataStax Enterprise and Cassandra
The error messaging of the DataStax PHP Driver could use some improvement...
Things that got me before with this error message:
Make sure you are connecting to the right server.
Might be a conflict
between the different versions.
But as far as I know, the DataStax PHP Driver does not support Cassandra 3+. Only version 2.1. And also version 2.2, but not completely.
From their docs:
Compatibility
This driver works exclusively with the Cassandra Query
Language v3 (CQL3) and Cassandra’s native protocol. The current
version works with:
Apache Cassandra versions 1.2, 2.0 and partially 2.1 DataStax
Enterprise 3.1, 3.2, 4.0 and 4.5 PHP 5.3.4+ Compilers: GCC 4.1.2+,
Clang 3.4+, and MSVC 2010/2012/2013 NOTE: Apache Cassandra 2.1 support
is limited to the Cassandra 2.0 API (native protocol v2), e.g. no
user-defined types.
DataStax PHP Driver for Apache Cassandra
Unfortunately I don't know anything about downgrading Cassandra...

Portable XAMPP Alternative

I was using XAMPP portable (for USB flash drives) for a long time. The creator team is no longer supporting/updating the project, which is not even compatible with the latest PHP version.
Is there any alternative all-in-one, portable web-server (like XAMPP) with latest updates?
Z-WAMP is the nicest portable WAMP I've found.
I've used Uniform Server in the past from a portable drive. The current version (8.5.5 at the time of writing, released 16/6/2012) has Apache 2.4.2, MySQL 5.5.25-community and PHP 5.4.4.
How about Laragon (http://laragon.org/).
Laragon offers you a powerful but Isolated Development Environment.
It is portable and very flexible.
Install Laragon doesn't affect your Windows. You can move Laragon installation folder to another disk and Laragon still works.
Laragon now supports Memcached and Redis (optional).
Current version: 0.3 (stable)
Apache 2.4.10
MySQL (MariaDB 10.0.15)
PHP 5.6.3
Memcached 1.4.5
Redis 2.8.17
Check Laragon out.
XAMPP is back in development!! As of Aug 2012 they released a new version that has all the latest Apache, PHP, and such. Check it out!
You can also check "Comparison of WAMPs on Wikipedia":
http://en.wikipedia.org/wiki/Comparison_of_WAMPs
All here listed WAMPs and more are included.
WTServer - Nginx MariaDB Redis Php development stack for Windows
updated regulary
The installer produces a portable folder.
Current Package contains:
Nginx 1.11.7 web server
MariaDB 10.1.19 database server, mysql replacement (32/64bit)
Redis 3.2 Cache/NoSql, memcached alternative (64bit)
Php 5.6.29 & PHP 7.0.14 & PHP 7.1.0 scripting language (32/64bit)
XDebug, GeoIP, Gender PHP Extensions
If you have an active internet connection and docker installed on your development machine, you could give devilbox a try.
It is a modern docker-based lamp stack offering various features:
Start up any php version (php 5.4 - php 7.1 or even hhvm)
Start up and sql version (mysql 5.5 - mysql 8 or all mariadb versions)
auto vhost creation
auto DNS
Email catch-all
and many others
phpMyAdmin
Adminer
OpcacheGUI
https://github.com/cytopia/devilbox

PHP - SQL Server 2005 express to 2008 standard problem

I have a PHP app running happily on the following system:
web app: PHP version 5.2.3
OS: Windows Server 2003 Standard 32 bit
database: SQL Server 2005 (express)
web server: IIS 6
I'm trying to get the same thing running on the following:
web app: PHP version 5.2.11
OS: Windows Server 2008 Standard 64 bit
database: SQL Server 2008 Standard 64-bit
web server: IIS 7
After doing the install and setup I usually do, phpinfo() is running but there is no MSSQL section. I've looked around and found some MS documentation to set up the system using a php_sqlsrv.dll and tried that but it seems to use a different interface to connect to the database (no more mssql_connect(), now it's sqlsrv_connect()). Is this the only way to connect php to SQL Server 2008 or do I just have the setup wrong? If I can go back to PHP 5.2.3 and have it work, that will be fine but I didn't want to undo what I have if it won't help.
Thanks,
There is an extensive tutorial on MSDN on how to do this.
http://msdn.microsoft.com/en-us/library/cc793139%28SQL.90%29.aspx
The extension named php_mssql.dll is linked with an old Microsoft library (ntwdblib.dll). This library was last updated with MS SQL Server 6.5. It's a 32 bit library and does not support many of the new features introduced in newer versions of the database. It is possible to compile a version of the extension using FreeTDS. That will give access to the latest version of the TDS protocol. This also allows you to access SQL Server from a Linux/Unix based system.
The extension named php_sqlsrv.dll is developed and maintained by Microsoft gives much better support for the newer versions of SQL server and it should work in both the environments you describe.
There should be a dll named php_mssql.dll in the ext folder of your php installation. You will want to make sure this is being loaded in your php.ini file with extension = php_mssql.dll . If that is not showing in phpinfo() after restarting the webserver it may be that you have installed the wrong thread safe version of PHP depending on how you've set things up with Fast CGI. You shouldn't have a problem using sqlsrv (SQL Server Driver for PHP). I would however recommend using version 1.1 of the driver as it has some improvements and supports SQL Azure. One thing you will notice is that datetime columns come back as PHP DateTime objects instead of strings. I've also noticed that you run into a lot less problems if you just install the stack with the Microsoft Web Platform Installer.
After having this issue and almost tearing my hair out for hours and giving up, I found the answer:
http://docs.moodle.org/22/en/Installing_MSSQL_for_PHP#Using_FreeTDS_on_Windows
php_dblib.dll is the "new" dll that supports the old mssql php functions (mssql_connect() etc). So basically this new dll replaces php_mssql.dll and everything just works as it did before. (Well it does for me now)
My server setup is:
O/S: Windows Server 2008,
DB: MSSQL Server 2008 R2,
PHP: 5.3.13
Excerpt from phpinfo():
System Windows NT XXXXXXXXXXXXX 6.1 build 7601 (Windows Server 2008 R2
Enterprise Edition Service Pack 1) i586 Build Date May 8 2012 18:41:52
Compiler MSVC9 (Visual C++ 2008) Architecture x86
Configure Command cscript /nologo configure.js
"--enable-snapshot-build" "--enable-debug-pack" "--disable-zts"
"--disable-isapi" "--disable-nsapi" "--without-mssql"
"--without-pdo-mssql" "--without-pi3web"
"--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared"
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared"
"--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared"
"--with-enchant=shared" "--enable-object-out-dir=../obj/"
"--enable-com-dotnet" "--with-mcrypt=static"
"--disable-static-analyze"
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\Program Files (x86)\PHP\v5.3\php.ini
Hope this saves someone some time.

Categories