By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

php global includes?

P: n/a
JGH
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?
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Fri, 1 Oct 2004 21:14:14 +0000 (UTC), JGH <jo******@nospam.tds.net> wrote:
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?
Yes. auto_prepend_file configuration variable.
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.
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.
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?


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

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
JGH
Andy Hassall <an**@andyh.co.uk> wrote in
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.

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_server: 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.

Jul 17 '05 #3

P: n/a
"JGH" <jo******@nospam.tds.net> wrote in message
news:cj**********@news.doit.wisc.edu...
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.


php.ini

http://uk.php.net/manual/en/ini.sect...o-prepend-file

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.