php global includes?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JGH

    php global includes?

    Isn't there some way to include some php code every time a php script is
    run without having to put an include statement in the script?

    All I want to do is set the ORACLE_HOME environmental variable on a
    development machine. The servers have it compiled into php and it's
    different on different machines. So programmers using the development
    platform shouldn't have to set ORACLE_HOME.

    I've been browsing the php documentation and doing google searches for an
    hour already. I thought there was a config file somewhere where you could
    put some php code and it would be run every time a script is run.

    Did I dream that?


  • Andy Hassall

    #2
    Re: php global includes?

    On Fri, 1 Oct 2004 21:14:14 +0000 (UTC), JGH <johnheim@nospa m.tds.net> wrote:
    [color=blue]
    >Isn't there some way to include some php code every time a php script is
    >run without having to put an include statement in the script?[/color]

    Yes. auto_prepend_fi le configuration variable.
    [color=blue]
    >All I want to do is set the ORACLE_HOME environmental variable on a
    >development machine. The servers have it compiled into php and it's
    >different on different machines. So programmers using the development
    >platform shouldn't have to set ORACLE_HOME.[/color]

    Wouldn't that be best set in your Apache startup script, or even /etc/profile
    (or equivalent) per machine? Unless it's in exactly the same path on every
    development machine... perhaps your development environment is well enough
    regimented to guarantee the location though.
    [color=blue]
    >I've been browsing the php documentation and doing google searches for an
    >hour already. I thought there was a config file somewhere where you could
    >put some php code and it would be run every time a script is run.
    >
    >Did I dream that?[/color]

    auto_prepend_fi le with a putenv() call is the closest match to what you're
    asking, as far as I'm aware.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • JGH

      #3
      Re: php global includes?

      Andy Hassall <andy@andyh.co. uk> wrote in[color=blue]
      > Wouldn't that be best set in your Apache startup script, or even
      > /etc/profile
      > (or equivalent) per machine? Unless it's in exactly the same path on
      > every development machine... perhaps your development environment is
      > well enough regimented to guarantee the location though.[/color]


      Well, maybe I should have asked that question first.

      This works:

      <?php
      putenv("ORACLE_ HOME=" . getenv("ORACLE_ HOME"));
      $conn = OCILogon ('username', 'password, 'host);
      OCIdisconnect ($conn);
      ?>

      But it doesn't work without the putenv (getenv()). I get the standard
      message indicating that it gives when ORACLE_HOME is not set.

      Warning: ocilogon(): _oci_open_serve r: Error while trying to retrieve
      text for error ORA-12154 in /home/jhe/public_html/index.php on line 17


      So even though I can getenv ORACLE_HOME, I still have to putenv it
      before OCI will work. This seems to be standard behavior unless you
      compile php with ORACLE_HOME.



      Comment

      • CJ Llewellyn

        #4
        Re: php global includes?

        "JGH" <johnheim@nospa m.tds.net> wrote in message
        news:cjkhb6$cnd $1@news.doit.wi sc.edu...[color=blue]
        > Isn't there some way to include some php code every time a php script is
        > run without having to put an include statement in the script?
        >
        > All I want to do is set the ORACLE_HOME environmental variable on a
        > development machine. The servers have it compiled into php and it's
        > different on different machines. So programmers using the development
        > platform shouldn't have to set ORACLE_HOME.
        >
        > I've been browsing the php documentation and doing google searches for an
        > hour already. I thought there was a config file somewhere where you could
        > put some php code and it would be run every time a script is run.[/color]

        php.ini





        Comment

        Working...