473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

php global includes?

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
3 2391
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jason | last post by:
What is the best way to handle global includes for 3 subwebs that may at various times consume similiar include files such as ENQUIRY FORMS. I ask this question as I now have the oppportunity to...
3
by: Eric Lilja | last post by:
Hello, I have a few global variables in my program. One of them holds the name of the application and it's defined in a header file globals.hpp (and the point of definition also happen to be the...
2
by: Patient Guy | last post by:
I have a library of functions representing a filesystem interface (essentially a file selection interface, to be used in opening/reading/writing/closing files). Heavily scripted HTML document...
10
by: Kleenex | last post by:
Reason: I am working on an embedded project which has very limited memory (under 512 bytes, 60 or so of which is stack space), which translates into limited stack space. In order to save on stack...
1
by: fd123456 | last post by:
Hi tshad, sorry for not coming back to you earlier. When I meant to add a method to Global.asax, I actually meant to add it to the code-behind file. If you click on "Global.asax" in the file...
6
by: calcop | last post by:
Hello everyone, I hope I can write this question clearly. Anyway, it is about global variables. I have several files in my C++ project. One of which is main.cpp. This file comtains my main()...
16
by: Roman Ziak | last post by:
Hello, there were times when I used to be looking for a way to access JavaScript Global object similar to those found in VBScript or PHP ($GLOBALS). At present this has only academic value for...
2
by: hrishikesh.mehendale | last post by:
Hi All, Sorry if I'm just repeating other questions, but I can't find an answer for this particular problem: I have my main index.php file, which looks so: <?php include "includes/header.php";...
19
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.