2 Replies Latest reply: Apr 20, 2011 1:15 AM by 856235 RSS

    How to run sqlplus commands in php


      I want to start and stop the oracle database from php page but i get the following error:
      ORA-00900: invalid SQL statement in /var/www/shutdown.php on line 13
      I read somewhere that oci_execute cannot execute sqlplus commands, so my question is if you know some workaround for this issue?

      Also I want to start the database also from a php page but I get the following error:
      ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory Process ID: 0 Session ID: 0 Serial number: 0 
      So can you help me with some hints ?

      Thank you,

      Edited by: user9223471 on Apr 18, 2011 11:37 PM
        • 1. Re: How to run sqlplus commands in php
          PHP OCI8 doesn't implement SQL*Plus client-tool commands like "SET PAGESIZE", "TTITLE" etc. Any statement you do an oci_parse() on is sent to the DB which only understands SQL & PL/SQL (ok, and XQUERY).

          PHP OCI8 can't start or stop the DB directly. It doesn't call the underlying C OCI8 OCIDBStartup() or OCIDBShutdown() functions (these functions are documented in http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10646/oci10new.htm#LNOCI096)

          You could patch PHP OCI8. Or think of an alternative business process / system architecture, such as using Enterprise Manager.
          • 2. Re: How to run sqlplus commands in php

            Thanks for you reply. You said about patching OCI8, but I use Zend Server so I think that OCI is already patch. I know about EM but is just an simple project not some serious production system.

            Best regards,