PHP and remote Oracle DB

Does anyone know what is needed to connect PHP to a remote Oracle 10g DB? I have followed the steps at http://www.oracle.com/technology/pub/notes/technote_php_instant.html but and a little confused because I am not the Oracle guy.
They speak of Oracle 10g's Easy Connect syntax and use a PHP variable $c = OCILogon('hr', 'hr_password', '//mymachine.mydomain/MYDB');. Now is there something on the Oracle DB side that allows this connection syntax? Is there anything on the DB side that I have to enable to allow this remote connection?
I've used MySQL and PHP but having no knowledge of Oracle makes it hard for trial and error.
I cant seem to find a simple answer (or it may be I dont understand it) on what is needed for a remote DB connection without them going into other avenues that involving tnsnames.ora or Oracle client environment variables.
I have PHP 5, Apache 2, and the Instant client on a Windows 2000 Pro machine, and a remote Red Hat AS 4 Oracle 10g Database.
Any help to lead me on the right path will be appreciated.

You probably don't have to do anything at the DB end.
Grab 10g instant client for your platform and build php with oci8 support.
In your php script you will only have to enter the "Easy Connect URL" for the database.
Let's say your oracle DB is running on a machine called alpha.com and the SID of the DB is FOO and the listener port is 1521. Then the easy connect URL is
//alpha.com:1521/FOO
You must already know the service name/SID of your DB.
The "Easy Connect" naming automatically changes the "easy connect url" to the correct TNSNAMES format.
(TNSNAME is the standard way of telling the OCI client the complete location details of the DB).

Similar Messages

  • DBA Cockpit: Planning calendar and remote Oracle databases- which method?

    For using DBA Planning Calendar to schedule BR*Tools for remote Oracle database AS Java systems I have successfully implemented both the Secure Shell and SAP gateway methods in [Note 1025707 - DBA Cockpit: Planning calendar and remote Oracle databases|https://service.sap.com/sap/support/notes/1025707] and was interested in which of these two methods others have found to be more supportable and maintainable?
    In more detail, the note has these two methods for non-ABAP remote systems:
    2. Connection through Remote/Secure Shell
    Specifically Secure Shell. Rejecting remote shell as too old and insecure a protocol.
    3 Connection through SAP gateway
    The note provides clues as to how these methods work. Expanding on that:
    With #2, central ABAP system calls out to its OS user level to execute the ssh client (after gw/rem_start has been set to the non-default value SSH_SHELL) which it finds in the location specified in gw/ssh (default value is /usr/bin/ssh). It must use password-less authentication and the key-based authentication must also not require a passphrase. (Using ssh-agent is not an option since this is being called from SAP, not from your own script.)
    It remotely runs via ssh a command, sapxpg, which must be found in the PATH of the remote user. (This is why the note, which has you place this exe sapxpg and a subset of the BR*Tools in the home dir of the remote user, also has you make sure the home dir is included in the path--your OS might or might not include the user's home dir in the path in the default shell environment for a new user.)
    Then via sapxpg, the BR*Tools are invoked.
    One thing that may be confusing here is you have to check at least one gateway parameter 'gw/...' in the central system to get the method #2 the non-gateway method to work--this is because the two methods are technically almost the same: in #2, secure shell is used to basically start a gateway on the fly with sapxpg in order to call the BR*Tools each time a DBA Planning Calendar action runs or you view DBA or Backup logs of the remote system from the central system. With #3, the gateway runs continuously on the remote system.
    With #3, central system connects to remote SAP standalone gateway, which executes the BR*Tools installed in the standard SAP kernel directory of the SAP gateway. This method is simpler to describe so it sounds like it has less components than the secure shell method, however you do have an entire SAP system running, although it is just a standalone gateway.
    Thoughts:
    These pros/cons are UNIX/Linux-oriented since I assume most Windows environments do not have added 3rd-party products that provide secure shell so SAP gateway is the only method.
    Secure shell
    + Less software required (not counting secure shell which comes with the operating system distribution): just a few SAP executables placed in the home dir of an ordinary user on the remote system.
    + Secure shell service probably automatically starts upon boot of the remote system operating system.
    + Secure shell is a widely used tool outside of SAP for executing commands remotely without passwords.
    - Installation is non-standard: shell environment of remote user is not adapted by SAP installer since SAP installer is not used, SAP executables in the home dir of the remote user is non-standard. Has to be setup manually.
    - Requires setting up secure shell key-based authentication, which should be known by UNIX/Linux admins or combined Basis/UNIX/Linux admins, but might be less familiar to SAP Web AS only admins.
    - If your admin config policy is to have SAP interact as little possible with the OS level for interfaces with other systems, here you are relying on the OS-level secure shell.
    - Using a private key that does not require a passphrase on the central system may not fit with your security policies if you have standards for secure shell configuration.
    SAP gateway
    + The gateway is a standard installation, performed with SAP installation tool, with the exception of a few additional environment settings that have to be added after the installation. BR*Tools are installed in the standard location. Can use standard procedures for updating this software.
    + Only uses SAP software.
    - More software on remote system: standalone gateway just to run BR*Tools and view logs.
    - SAP Kernel of remote gateway should probably be updated whenever you do SAP kernel updates across your systems for consistency. One more system to update.
    - Shell environment of remote user that runs the gateway looks like something setup by the SAP installer but is not standard because it has a few additional environment variables added.
    - Need to make sure the SAP gateway is started on the remote system.

    Hi Joe,
    I configured a monitoring/dba landscape for two SAP Portals and one SAP BusinessObjects system on a SAP landscape by using DBACOCKPIT, at a customer site. These systems are running on AIX, Windows 2003/2008 servers and attached to the central monitoring system with standalone SAP gateway installations.
    One another reason to not use OS based commands or 3rd party tools is security. We are stopping and disabling most of the services on OS where SAP system is running on, because of the security reasons. I faced more security gaps on rsh/ssh and the other tools than standalone SAP Gateway installations. As you can figure out that rsh/ssh is getting more attack than standalone SAP Gateway, because of well known by the IT world.
    As a summary of it, this depends to point of view and policy of the IT organization. I applied both ssh and standalone SAP Gateway solutions at my customers, but I choose standalone SAP Gateway installation among of them.
    Best regards,
    Orkun Gedik

  • PHP and OCI-Lob::read from oracle clob

    I'm having a weird problem with PHP and the OCI-Lob::read method.
    We have a page that connects to the database and pulls all the other fields out with no problems. However, it when it comes to the clobs, only a small portion of the actual data is retrieved.
    The code uses:
    $content= $features[14]->read(2000); echo $content;
    And we're getting a tiny section of the field returned (only about 185 out of a total 553 chars). The really strange thing is that no matter what the length specified is - it still only returns a small section - and the cut off seems to actually be 549 bytes/chars - anything below the read(length) specified as 549 shortens the returned string (even though what is returned is far less the 549 chars) but anything over 549 makes no difference.
    Additionally, we've used the OCI-Lob::load method with exactly the same results where only a portion of the actual contents of the clob field is returned.
    Any ideas what could be causing this?
    PHP version is 5.1.6
    RDBMS is 11.2.0.4.2
    Following shows OCI config via phpinfo()
    oci8
    OCI8 Support
    enabled
    Revision
    $Revision: 1.269.2.18 $
    Active Persistent Connections
    1
    Active Connections
    1
    Oracle Instant Client Version
    10.2
    Temporary Lob support
    enabled
    Collections support
    enabled
    Directive
    Local Value
    Master Value
    oci8.default_prefetch
    10
    10
    oci8.max_persistent
    -1
    -1
    oci8.old_oci_close_semantics
    0
    0
    oci8.persistent_timeout
    60
    60
    oci8.ping_interval
    60
    60
    oci8.privileged_connect
    Off
    Off
    oci8.statement_cache_size
    20
    20

    Your version of OCI8 corresponds to PECL OCI8 1.2.1, which is very old.  You can see the subsequent fixes in the changelog PECL :: oci8 Changelog In particular there have been a number of LOB changes.
    I would start by upgrading. Ideally you would use PHP 5.5 with PECL OCI8 2.0.8 and Instant Client 11.2.0.4.  Otherwise just upgrade to PECL OCI8 1.4.10 and Instant Client to 11.2.0.4.  The following instructions should help: Installing PHP and the Oracle 11g Instant Client for Linux and Windows
    I am suggesting using PECL OCI8 because it is more recent than the OCI8 in the PHP 5.1.x - 5.5.x bundles.  PHP 5.6 natively has OCI8 2.0 but you may not want to upgrade an existing site to PHP 5.6 until this branch of PHP has matured.

  • How i can connect php and oracle9i ?

    hello am new to php.i have oracle 9i and php and apache.oracle is installed at one system and php inother one at network .when i have at same pc's i connect it.but now it's at different systems how i can connect.plzz tell me complete steps of apache that i will define and next complete process to connect php and oracle .plzzzzzzzzzzzzzzzzzzzzzzzzzzzz

    Apache and PHP need to be on the same system. That system also needs either the database or Oracle client libraries like Oracle Instant Client. There are steps for installation of the PHP side on http://www.oracle.com/technology/tech/php/index.html
    There are various Oracle installation notes in the Oracle manuals or software bundles.
    -- cj

  • PHP connecting on Oracle by hostname

    Hello,
    I need to know if is possible to connect PHP on remote Oracle 10g through Easy Connect(hostname), without Oracle Client.
    Regards
    Amanda

    No, it is not possible.

  • PHP and Oracle DB Job Find

    Hi every ones:
    I'm develop some applications using PHP and Oracle and php give me a lot of advantage. in bouth way of access to a database, OCI and mod plsql.
    How can i say to Oracle THANKS FOR TAKE SERIOUS PHP TECNOLOGY!!!
    I work actually for a company that implement all (Microsoft) and i want find a job with PHP and Oracle programming. Any body have idea that where i need look?

    How can i say to Oracle THANKS FOR TAKE SERIOUS PHP
    TECNOLOGY!!!You just did! Thanks!
    You can help Oracle with scripting languages even more, by completing the questionnaire on scripting langauges at:
    http://www.oracle.com/go/?&Src=1545492&Act=10
    Alison

  • PHP and Oracle Workflow

    Hi everyone,
    Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code?

    All of the public documented Workflow Engine PL/SQL APIs and Java APIs enable customers to build their own screens based on workflow, such as building your own specialized worklist.
    Hi everyone,
    Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code?

  • PHP  and Oracle Connection

    Please help to connect to oracle through php.
    OS=Windows Server 2008 R2(x64)= is working correctly
    PHP ver=PHP 5.3.2= is working correctly
    ORACLE = Oracle Database 11gR2= is working correctly
    Since the PHP and Oracle on the same machine, I did not install install client(but even with instan client I could not connect to oracle).
    phpinfo does not show oci section
    in Environment section shows these values
    PHPRC = C:\Program Files (x86)\PHP\
    LD_LIBRARY_PATH = D:\ipardb\ora_base\product\11.2.0\orahome\lib
    NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
    ORACLE_HOME = D:\ipardb\ora_base\product\11.2.0\orahome
    ORACLE_SID = iparbio
    Path= C:\Program Files (x86)\PHP\;D:\ipardb\ora_base\product\11.2.0\orahome\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.1\bin;
    TNS_ADMIN= D:\ipardb\ora_base\product\11.2.0\orahome\network\admin
    Loaded Configuration File C:\Program Files (x86)\PHP\php.ini
    uncommented extension in php.ini
    [PHP_OCI8_11G]
    extension=php_oci8_11g.dll
    extension dir is set ok, since other extensions are working properly
    when i execute php.exe, in error_log file appears
    [11-Jun-2010 10:37:34] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application.
    in Unknown on line 0
    Please help me.

    I'm guessing the cause is probably the same as that article: PHP is 32bit but your Oracle libraries are 64bit.
    You will need to install 32bit instant client and make sure they are used for Apache. Does Windows 2008 have sym links? Perhaps the note mentioned at the end of OCI8 IN WINDOWS SERVER 2008 x64 will help. Otherwise try creating some batch scripts to set PATH appropriately before starting Apache.

  • Are there different php functions for Oracle 8 and 9?

    Hi!
    Are there different php functions for Oracle 8 and 9?
    Thanks for your answer!

    You can use the oci8* functions for Oracle 8, 9 and 10.
    It is the most recent PHP interface to Oracle, and uses Oracle's most recent
    API.
    The name oci8 comes from the version number of Oracle - version 8 - when
    Oracle introduced a new C API. It succeeded the original OCI and got the
    common name OCI8. The original OCI now has the common name of OCI7.
    -- CJ

  • Is it possible to work with PHP pages in Oracle ERP R12 and how to set up ?

    Hi,
    Is it possible to work with PHP pages in Oracle ERP R12 and how to set up ?
    Regards
    Nandhakumar P

    Hi Nandhakumar,
    To be able to access any Oracle database using PHP you require the following:
    A server with Apache 2+  (Unix, windows etc)
    PHP enabled using OCI8
    tnsnames.ora
    Oracle instant client and associated libraries
    This gives you direct access into oracle database. As for E-Business, you will compromise the security and safty of of R12 by going in through php. Oracle is not likely to support it either.
    I have got a apache/php/Oracle XE working on a test environment and Ithe performance is not a big issue. If you must I would hughly recommend Oracle Linux for quality and security.

  • DW9, PHP, and Oracle

    We've just installed DWCS3 and now our Oracle (Oracle Thin
    Client) database connections are no longer available with DWCS3. We
    have just learned that DWCS3 will not work with Phakt and that PHP
    now only supports MySQL. Dropping Phakt without any PHP-to-Oracle
    alternatives is a serious threat to our continued use of Adobe web
    products because TCO / ROI concerns, facing the fact we may have to
    rebuild our websites.
    We need to continue to use PHP to access our Oracle dBs. Does
    anyone have any recomendations for a work-around to this sorry
    behavior?

    All of the public documented Workflow Engine PL/SQL APIs and Java APIs enable customers to build their own screens based on workflow, such as building your own specialized worklist.
    Hi everyone,
    Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code?

  • Re: PHP  and Oracle Connection

    Are any specific links that will give me all knowledge regarding php and oracle connection? I am a new babie in this please help me out.

    Hi,
    I'm looking for specialists in PHP, Ajax and Oracle BPEL...
    Pages are: Praxisbörse und Jobs für Arzt und Zahnarzt http://www.praxis-welt.de für Praxisangebote und Jobangebote für Ärzte
    sowie auf http://www.berlin-umzug.net für Umzugsunternehmen aus Berlin für Umzüge, Klaviertransport und Tresortransport in Berlin.
    Any ideas / information / knowhow?
    Regards,
    Mic

  • Visual Studio/ Oracle set up with both local and remote database

    Hi, I am developing a database application in Visual Studio 2010, and have installed Oracle Database 11g Express on the same pc - (Windows 7, 64bit).
    Now I am faced with what I need to install next: I've seen that Oracle Developer Tools for Visual Studio is required/recommended, but as it comes as part of the ODAC suite, it asks if I want to install the client or server version. Which should it be?
    And would the situation change if I also needed to connect to a remote (Oracle 10g) database? I'm keen to avoid having tnsnames files all over the place, if at all possible, but would I need a separate Oracle client installation in either case?
    Many thanks,
    Nick

    Hi,
    Are you actually going to drag and drop things from Server Explorer, and or use Sever Explorer to create/edit/debug stored procedures and such? If so, you'll need (32 bit) Oracle Developer Tools installed, and you'll need to install it into a separate home from the Express home.
    If you're just going to "hand code" ODP.NET, you can use the ODP.NET that installs in the Express home. Note though that in VS2010, projects default to compile target of "x86", so to run a 64 bit app with the 64 bit ODP/client (assuming you installed 64 bit db home), you'll need to change it to x64.
    You can connect from ODP.NET without tnsnames via the EZConnect version of the connect string.. ie,"data source=//serverhost:port/db_service_name; user id...etc.."
    You can use 11g client against a 10g database.
    Hope it helps,
    Greg

  • Is my configuration correct? PHP and Oracle HTTP server

    Hi all,
    I have a single server running RHEL5 x86-64 and Oracle 11.1. I also have the Oracle HTTP Server which purportedly has "PHP support".
    I am trying to do a basic test connect to my database, but I'm getting an error.
    My test is the following:
    <html>
    PHP Test with Oracle<head>
    <body>
    <pre>
    <?php
    $conn = oci_connect('scott', 'tiger', 'myserver/MYDBSERVICE');
    if (!$conn) {
    trigger_error("Could not connect to database", E_USER_ERROR);
    ?>
    </pre>
    </body>
    </html>When I open the page, I see the following:
    PHP Test with Oracle
    Fatal error: Call to undefined function: oci_connect() in /u01/app/oracle/product/HTTP_Server/ohs/htdocs/phptest/dtest4.php on line 6
    I've also tried phpinfo() and get the following:
    oci8
    OCI8 Support      enabled
    Revision      $Revision: apache_modules/mod_php/4.3.9/ext/oci8/oci8.c#0 $
    Oracle Version      10.1
    Compile-time ORACLE_HOME      /ade/svadugur_mjoyphp4311/oracle
    Libraries Used      no value
    Any idea what may be going on? I've looked through much documentation already before posting to no avail.
    Thank you for any insight.

    The oci_* names were introduced in PHP 5. In PHP 4 the equivalent connection command is ocilogon(). For other mappings see Appendix C of the free book http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
    I'd recommend you upgrade PHP. See "Installing OCI8 with Oracle Application Server on Linux" on p 76 of that book. Note the warnings.

  • A book for php and oracle

    Hi.I' m working in an application using php for web development and oracle for server database.My question is until now I found many links about this subject also many books about oracle,plsql and many books about php but I can't found a book about php with oracle and plsql.So my question is are there books about php and oracle?
    Thanks in advance thrylos

    I have seen one in my local book shop, not sure about Internet though.

Maybe you are looking for

  • How to Resolve HTTP 500 error in sharepoint 2013 workflow

    Hi guys,              I am new to Sharepoint. I have created a workflow for sending if a document added or edited in a document library. When i added a document i workflow status shows workflow started. But when checked in the internal status of the

  • Log file size increasing

    Hi, the log file in our Oc4j-soa container is getting increased once in 2 min with the following messages: <soa-home>/opmn/logs/default~oc4jsoa~log ORABPEL-12141 ERRJMS_CONN_FAC_NOT_FOUND. Unable to instantiate connection factory. JMS adapter was una

  • 30" Cinema Display on my 2003 G5?

    I'm getting a lot of conflicting information and hope to hear from someone who has done this. I ordered one of the early G5s - sept 2003 - which is a dual CPU 2 GHz machine with the ATI Radeon 9800 Pro graphics card. I know THIS card will not support

  • How to make field in personal setting to optional?

    Hello, We want to make this field "Form of address" as optional in the personal settings. The form of address has a drop down for "MR"/ "Mrs" Currently it is mandatory and causes additional unwanted work. We are in SRM 7.0. Any help is much appreciat

  • Oracle9iAS J2EE and Web Cache

    Hi! I'm using Oracle9iAS J2EE and Web Cache on my Sun Solaris 5.8 and when I try to Log on to Oracle Enterprise Manager on port 1810 from my Windows 2000 browser I have this error: Servlet error: Renderer failed: java.lang.NoClassDefFoundError To cor