I have downloaded;
Oracle Linux 7.2
Oracle Database 12c for Linux
Oracle Instance Client for 12c
(All are of the same version)
What I was successful with;
Installing Oracle Linux on VMWare
Installing Oracle Database 12c
I need to;
Install LAMP with the capability of connecting to Oracle Database.
Install Instant Client with the capability of connecting php to Oracle Database.
Install phpmyadmin
Please Help ...
There are PHP RPMs (including one for the PHP OCI8 driver to connect to Oracle Database) at http://yum.oracle.com/oracle-linux-php.html
You will need to install the 'Basic' package from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html first (this requires a click-through so it can't be in a yum channel). It sounds like you have done this.
There's a lot of useful info about PHP OCI8 in the back half of this free book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
Related
I was struggling to connect my Drupal (7.43) application (hosted on a PHP 5.4 server) to a Microsoft Azure SQL database.
I got really depressed and even found myself arguing with my company's DBA for why did you install this database on the newest version of SQL Server?.
Edited:
The reason why I asked that was because of Microsoft official documentation which says one should not connect to newer versions of SQL Servers if PHP server version is under 7.*.
System Requirements for the Microsoft Drivers for PHP for SQL Server
https://learn.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-ver15#driver-versions
According to this article, if PHP server version is 5.4, the official MS driver for such php server is 3.2 version. Therefore, if the SQL Server driver is 3.2, it should not connect to SQL Server version higher than 2014.
TL; DR;
I used FreeTDS to connect 5.4 PHP application to Azure SQL Server! Yaay
FreeTDS is re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server. It allows many open source applications such as Perl and PHP (or your own C or C++ program) to connect to Sybase or Microsoft SQL Server.
My operational system is CentOS 7.
I installed basic yum packages for http server and php database connection.
yum install httpd httpd-tools php php-common php-cli php-odbc php-pdo unixODBC unixODBC-devel
So far I understand:
PDO stands for PHP Data Objects.
ODBC stands for Open Database Connectivity -- which is a standard application programming interface for accessing database management systems.
Alright, I then installed FreeTDS:
yum install epel-release
yum check-update
yum install freetds freetds-devel
Then I had /etc/freetds.conf:
[MYCLIENT]
host = myclient.database.edtech.com
port = 6669
tds version = 8.0 # Btw, how important is this version for old PHP servers versus new SQL servers?
I also had /etc/odbcinst.ini
[FreeTDS]
Driver = /lib64/libtdsodbc.so.0
FileUsage = 1
Furthermore, I had /etc/odbc.ini:
[MSSQLServer]
Driver = FreeTDS # Yes, ODBC will use FreeTDS, I get it.
Description = MSSQL Server
Trace = Yes
Server = myclient.database.edtech.com
Port = 6669
TDS_Version = 7.1 # Shouldn't this be same as the version in /etc/freetds.conf?
Database = ApplicationDB
Conclusions
I hope this question helps others.
FreeTDS is a different driver
than Microsoft's.
PHP does not know about FreeTDS not FreeTDS knows
about PHP version.
As far as I understood from the answers, there is
a ODBC bridge/layer in between them.
Better use the newest FreeTDS
version to make sure the connection works.
You said
The reason why I asked that was because of Microsoft official documentation which says I cannot connect to newer versions of SQL Server if my PHP version is below 7.*.
and
Is this php 5.4 connection really supposed to work with newest SQL
Server despite the official Microsoft docs say it should not?
...but actually, the Microsoft documentation you're talking about doesn't say you can't connect to SQL Server from PHP 5.4.
They said you can't (or at least you are not supported to) do that by using the Microsoft Drivers for PHP for SQL Server - which is the specific product that documentation is talking about.
FreeTDS is a different driver. By replacing the driver, you've replaced the thing which Microsoft is saying you shouldn't use. AFAIK Microsoft have no involvement with FreeTDS, so what they support, and what their driver works with, is entirely up to them.
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.
I have oracle 12c R2 installed and xampp with php 7.1.7. Oracle 12c is 64 bit on my 64 bit windows 10 machine. But xampp is 32 bit.
How do I connect my oracle 12c with php?
Do I need to download oracle 12c 32 bit client and then use oci8?
If XAMPP is 32-bit, then you need 32-bit Oracle client libraries in your PATH since the PHP executable & OCI8 extension will be running as 32-bit.
If you also have a database on the same machine, make sure not to stuff up anything if you change PATH globally. You might need to change PATH just for XAMPP.
The Oracle Net layer between PHP OCI8 and the database will handle any 32-bit to 64-bit data conversions.
I need to connect to an Oracle 8i server, but oci8 does not support it by default.
The php documentation says as following:
Note:
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.
How can I setup OCI8 to use 9iR2 client libraries?
My current environment is:
I'm on a ubuntu server,
Oracle 8i version 8.1.7.4.0
I have already installed instantclient libraries(I'm able to connect to oracle 10i and above)
I'm using instantclient version 12.1... Also tried with instantclient version 10.2
Could someone help me figuring out what the problem might be and how to solve it? Any help is really appreciated.
Thank you
I'm trying to connect a new project CakePHP v3 installed in a common LAMP on Ubuntu Server and the DataBase is a MSSQL 2008. I've tried to install the library php5-mssql but nothing changes. Any idea?
The error message received is:
CakePHP is NOT able to connect to the DataBase.
DataBase driver Cake\Database\Driver\Sqlserver cannot be used due to a missing PHP extension or unmet dependency
Thanks!
CakePHP does not have an ODBC driver at this time. You can connect to MSSQL servers using the SQLServer driver from a Windows server, but this issue (https://github.com/cakephp/cakephp/issues/6990 ) just keeps getting bumped.
Since Cake3 uses PDO drivers to connect SQL Server (from Linux), you should try to install Microsoft ODBC Driver for Linux, see
http://onefinepub.com/2013/03/ms-sql-odbc-ubuntu/
it may helps