Hi,
I am using PHP 5.0.1 with Apache 2 on Win XP (SP2).
My index.php file has require_once contents.php and also for
functions.php.
My contents.php file also has a require_once for functions.php.
When this code is tested on one machine, it works fine. However on
another machine with identical configuration (same PHP 5.0.1, XP+SP2,
Apache 2), an error message appears :
test_timeout function redeclared.
(test_timeout function is in functions.php file.)
We have tested it with PHP 5.0.3 - same problem happens.
For running the PHP, MySQL, Apache combination, our setup steps are:
1. Install PHP - customize the .ini file
2. Install MySQL
3. Install Apache - customize the httpd.conf for using PHP
4. Copy libmysql.dll from ...\php\ dir to windows\system3 2 dir
The configurations are exactly same for both machines. The two machines
have identical PHP, MySQL and Apache physical directory paths. The
php.ini and httpd.conf (for apache) are copied from machine 1 to
machine 2. And we are testing the code locally using localhost.
Can anyone please give some hint as to the possible cause of this
problem. Am I missing something here?
Thanks,
Saayan
The file locations
home/index.php
home/secure/contents.php
home/secure/functions.php
in index.php:
// blah blah
require_once("s ecure/contents.php");
// blah blah
require_once("s ecure/functions.php") ;
in contents.php:
// blah blah
require_once("f unctions.php");
// blah blah
Jul 17 '05
14 2731
.oO(se****@gmai l.com) There is nothing wrong with PHP w.r.t require_once. The problem is, inmachine 2:.../home -> has a functions.php .../home/secure/ -> also has a functions.php
this proves that the require_once('f unctions.php') in contents.php is failing on server 1...
No!
there is no functions.php in the 'home' directory (which is where PHP is looking for the file).
PHP looks there first, if it can't find one it looks in /home/secure
(the same directory where contents.php is stored). It's all correct.
Micha
My bad. I was unaware that it would look in the 'secure' directory if
it failed in the 'home' directory. Not to mention that 'require()'
would produce a fatal error if it couldn't find a file.
thanks
r.
I was trying to simplify things a bit. Unless you change it with a call
to chdir(), the cwd is the same as the script directory. Including a
file in a different directory does not change the cwd to that
directory.
I'm at a loss as to why require_once("f unctions.php") manages to find
secure/functions.php. I think most of us would agree that it's not
supposed to happen, unless /home/secure is in the include_path. If it
is, then why does require_once() fail to see that it's the same file?
Since this happens on Windows, maybe it's a forward slash vs. backward
slash misinterpretati on within PHP.
In any event, providing absolute paths to include/require is the
preferred practice. That way you know for certain what you're
including. An example:
define('SECURE_ INCLUDE_ROOT', dirname(__FILE_ _) . "/secure/");
function require_secure( $filename) {
require_once(SE CURE_INCLUDE_RO OT . $filename);
}
On 12 Jan 2005 12:59:47 -0800, "ch***********@ hotmail.com"
<ch***********@ hotmail.com> wrote: I was trying to simplify things a bit. Unless you change it with a call to chdir(), the cwd is the same as the script directory. Including a file in a different directory does not change the cwd to that directory.
Yes, that's the point from the manual snippet I posted. cwd is searched first,
then the directory containing the current script. When you include a script
outside the cwd, then all include_path directories relative the directory
containing the included script become candidates for searching, once all
equivalents relative to cwd fail.
--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:fa******** *************** *********@4ax.c om... On 12 Jan 2005 12:59:47 -0800, "ch***********@ hotmail.com" <ch***********@ hotmail.com> wrote:
I was trying to simplify things a bit. Unless you change it with a call to chdir(), the cwd is the same as the script directory. Including a file in a different directory does not change the cwd to that directory. Yes, that's the point from the manual snippet I posted. cwd is searched
first, then the directory containing the current script. When you include a
script outside the cwd, then all include_path directories relative the directory containing the included script become candidates for searching, once all equivalents relative to cwd fail.
-- Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk > <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Crap. I got egg on my face. I've always understood "current script" as being
the file reported by PHP_SELF. Turned out I'm way off. Thank you, Andy and
Michael, for point it out. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my webserver runs that part of the
script (see attached file, snippet.php), though, it doesn't go through.
I don't get an error message or anything...it just returns a "1"
(whereas it should return a "0") as far as I can tell. I have read the
PHP...
|
by: chunmok |
last post by:
When compile using g++, following error messages appears.
/usr/include/sys/sysinfo.h:101: `struct sysinfo_t sysinfo' redeclared
as differe
nt kind of symbol
/usr/include/sys/systeminfo.h:77: previous declaration of `int
sysinfo(int, char
*, long int)'
....
szh.cpp:899: no match for call to `(sysinfo_t) (int, char, long
|
by: John Collyer |
last post by:
Hi,
In assembly language you can use a lookup table to call functions.
1. Lookup function address in table
2. Call the function
Like:
CALL FUNCTION
|
by: Chuck Martin |
last post by:
I am having a most frustrating problem that references, web searches,
and other resources are no help so far in solving. Basically, I'm trying
to design a pop-up window to be called with a funciton in a link. that
function can have parameters for URL and window name passed to it.
This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two separate
computers, I get an "onject expected" error. Going to the MS-based
debugger just tells me...
|
by: Rob Somers |
last post by:
Say I have the following code:
void foo(int some_int);
.....
int x = 5;
foo(x);
.....
void foo(int some_int)
{
| |
by: Mr Newbie |
last post by:
I am often in the situation where I want to act on the result of a function,
but a simple boolean is not enough. For example, I may have a function
called
isAuthorised ( User, Action ) as ?????
OK, this function may return a boolean, and if this is true, then no message
back is really required, but if it fails then some supporting message needs
to be returned to the calling code. As I see it there are a few options.
|
by: Jake Barnes |
last post by:
In the function below, the reset() method has no effect. What is the
correct way to ensure that
singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox is
empty?
function getArrayOfElementsForCommunicationBox() {
// 02-12-06 - I'm thinking it would be nice to have a global
object that contains two
// arrays, plus get and set methods for those arrays. Functions
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2
Ask on python-list@python.org .
- Josiah
|
by: newbie |
last post by:
Need a virtual function be redeclared in child class? I thought it's
not necessary, but g++ compiler complains that I didn't declare foo()
in B_Foo. I thought I can optionally do it because AbstractFoo already
does so. am I right?
Thanks
//class.h
class AbstractFoo {
public:
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |