Connect to Oracle8i from PHP - php

I am building a web application on a Ubuntu Server 13.10 running Apache and PHP to connect to a RHEL production server on our LAN running Oracle8i (Oracle8i Enterprise Edition Release 8.1.7.4.0).
I have only connected to MySQL in the past so Oracle is a bit of a learning curve PHP wise. I have searched online but have found contradicting articles so looking for some feedback on any prerequisites required to be able to connect PHP to the Oracle server.
For MySQL it was as simple as installing the php5-mysql package and using mysqli_connect(ip,user,password,db); to connect. Are there PHP packages required for Oracle? Some sites mention a tsnames.ora file and others don't, and other sites are aimed towards newer Oracle versions (upgrading Oracle is not an option).
I am basically looking for some quick start tips on how to even get connected to the Oracle server.

Oracle uses the php5-oci8 package to enable the PHP Oracle connections. It should be just as simple to install that package and get it working.
Here's a helpful page on how to do that within Ubuntu.

Related

How to set up a server to run an application which is based on PHP language

We have real old server running DTS packages and SSMS 2008 or older. We need to transfer our DB to new server that can also run PHP applications.
What do I need to do to set it up?
Thank you,
If you are using an old Win server that is vulnerable to hacking and wish to replace it with a new one (capable of running PHP), broadly you have two choices:
Windows Server
a) You may stick to using Win server OS and upgrade the db version and server OS to the latest version (SQL Server 2022 and Win Server: 2022) , then if you wish to run PHP on the machine, you may install it thru Microsoft Web Platform Installer so that the machine will be one with IIS capable of running PHP. For details, please refer to MS site:
https://learn.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php
Linux Server
b) you may choose to set up a linux server which is capable of running PHP/MySQL, and migrate the existing MSSQL database (as you have specifically mentioned) to MySQL thru some sort of migration tools
For setting up a linux server capable of running PHP (aka LAMP), you may refer to the following link (and others)
https://superuser.com/questions/993316/how-do-i-set-up-a-lamp-server-from-scratch-using-centos-6-7
For migrating the MSSQL to MySQL, you may refer to this SO post for some reference / information:
How to migrate SQL Server database to MySQL?
I prefer Ubuntu for a long time, so I would install the latest Ubuntu version on a server.
I would use apt install to install mysql and php8.
Dump the old database to file and copy it to new server.
Import the new database.

As I connect APP OpenShift php with MSSQL remote?

I would like to know how to compile mssql in php5.4 of Openshift? I've heard of freetds, but really I'm a bit of a novice with this and have not managed to make it work.
I want to connect to a remote server from my application MSSQL OpenShift php.
you can with a rhc code or install a DIY cartridge?
please help
OpenShift Online does not currently have any of the modules that you would need to connect to MSSQL installed. You have a couple of options:
Visit https://openshift.uservoice.com and add a suggestion for installing modules that would enable you to connect to a remote MSSQL server from the PHP cartridges.
Write an API in front of the MSSQL database that enables you to interact with it in the way that you need to. Maybe using another hosting provider that has the MSSQL extensions installed or a windows hosting provider,etc

Does the mysql client package version on webserver affect PHP queries?

I have two RHEL servers, one to host the PHP application, one to host the MySQL server.
Database server has MySQL Enterprise version 5.6.21 installed.
While getting the application server built, I asked that the rpm MySQL-client-advanced-5.6.21-1.el6.x86_64 be installed (to match server), but the hardware people don't like this version since 5.6.27 is available which addressed some vulnerabilities.
The question is the following:
Does the mysql client version on the application server affect the database queries coming from the PHP application?
We're using PDO to connect to and query MySQL.
If we do this, does the application server even need a mysql client library?
Please let me know if I can clarify.
Thanks!
PHP uses its own library/driver to connect to MySQL databases. The MySQL-client-advanced package is just the CLI mysql client. PHP does not use this.
For PHP (and PDO), you should install php-pdo and php-mysqlnd. php-mysqlnd is the "MySQL native driver" and contains some enhancements. It also contains the mysqli class and the pdo-mysql connector.
Note: php-mysqlnd versions are unrelated to the MySQL server version.
Quote from the Mysql website
MySQL Native Driver is a replacement for the MySQL Client Library (libmysqlclient). MySQL Native Driver is part of the official PHP sources as of PHP 5.3.0.
https://dev.mysql.com/doc/apis-php/en/apis-php-mysqlnd.html

Mysqli and OCI8 activation on Redhat Linux

I am a novice developer in web, and I have the following situation:
One of my customers wants to 'activate' php extensions for mysqli and oracle (oci8) on a Redhat Linux server.
The actual goal would be to be able to communicate (connect) with a remote Oracle database , which is located on a remote Unix server.
What do I have to do in order to implement those requirements?
Also note that any actions have to be available for command line, since I only have remote access to the Redhat server.
Thank you in advance.
p.s:
The Redhat server already has the following installed:
Oracle 10g.2
php 5.1.6
Apache 2.2.3

PHP MS SQL Unix Driver - Microsoft or FreeTDS

I am running a LAMP server but now need to connect to MS SQL (client request). I have heard Microsoft has a driver, but can't verify if
Does anyone know if the Microsoft driver is available for Unix? If not, should I just stick with FreeTDS? This appears to be recommended by PHP, however install documentation seems lacking. Any direction on either would be greatly appreciated.
Sorry for the general question, I am not familiar with setting up PHP drivers.
UPDATE
Just for some back story, I am running an intranet from the LAMP server but needs to connect to a datasource on an external MS SQL DB Server (Windows of course). I am running PHP5.
FreeTDS is fine and works well enough. The Microsoft driver is Windows only, thus you wouldn't be able to use it on your Linux server.
First install FreeTDS and then configure PHP with --with-mssql=/prefix/used/for/freetds. If you are using your distribution's PHP, I'm sure there is a MS-SQL driver package already precompiled and available for installation (in Ubuntu, that'd be php5-sybase).
Then use PHP's mssql_* functions to actually do the work
For anyone who comes across this rather old question...
It should be noted that since 2010, Microsoft has actually developed a viable Linux driver for SQL Server that is installable via PECL. It's currently only compatible with PHP 7.
The main readme file is here, which lists some general and overly complicated installation instructions. But if you look at the latest release notes you will see that newer versions can be installed via PECL like so:
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv

Categories