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 14 2725
On 11 Jan 2005 09:01:09 -0800, sa****@farfence .com wrote: 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.ph p. 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_timeou t 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(" secure/contents.php"); // blah blah require_once(" secure/functions.php") ;
in contents.php: // blah blah require_once(" functions.php") ; // blah blah
Nothing looks obviously wrong...
It's Windows so differences in filename case might be an issue? (I can't
reproduce the issue though).
You say the configs are the same - if you hadn't said php.ini is identical I'd
wonder if it's an include_path issue somehow picking up a different
functions.php between the two calls?
Can you demonstrate it failing, e.g. by setting up mini versions of that
directory structure with a dummy function in functions.php, and running it from
the command line? e.g. here's it not failing:
D:\public_html\ php_usenet\requ ire_once>type index.php
<?php
print __FILE__ ."\n";
require_once('s ecure/contents.php');
require_once('s ecure/functions.php') ;
?>
D:\public_html\ php_usenet\requ ire_once>type secure\contents .php
<?php
print __FILE__ ."\n";
require_once('s ecure/functions.php') ;
?>
D:\public_html\ php_usenet\requ ire_once>type secure\function s.php
<?php
print __FILE__ ."\n";
function x()
{
print "x";
}
?>
D:\public_html\ php_usenet\requ ire_once>d:\php-5.0.3-Win32\php.exe -q index.php
D:\public_html\ php_usenet\requ ire_once\index. php
D:\public_html\ php_usenet\requ ire_once\secure \contents.php
D:\public_html\ php_usenet\requ ire_once\secure \functions.php
--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
<sa****@farfenc e.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . 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
Your require_once statements are kinda screwy. contents.php is actually
loading the home/functions.php, because relative paths are relative to the
running script (home/index.php) and not the file which contains the
include/require statement.
On Tue, 11 Jan 2005 18:37:17 -0500, "Chung Leong" <ch***********@ hotmail.com>
wrote: 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
Your require_once statements are kinda screwy. contents.php is actually loading the home/functions.php, because relative paths are relative to the running script (home/index.php) and not the file which contains the include/require statement. http://uk2.php.net/manual/en/function.include.php
" Files for including are first looked in include_path relative to the current
working directory and then in include_path relative to the directory of current
script. E.g. if your include_path is ., current working directory is /www/, you
included include/a.php and there is include "b.php" in that file, b.php is
first looked in /www/ and then in /www/include/. If filename begins with ../,
it is looked only in include_path relative to the current working directory."
--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Thanks for your reply. There is no home/functions.php file. There is
only one functions.php file and it is home/secure/functions.php.
Obviously the script has no problem locating the file for loading. The
multiple loading is the issue here.
The only difference between the two require statements is:
index.php says -> require_once("s ecure/functions.php") ;
contents.php says -> require once ("functions.php ");
So, even though they are the same file, is the require_once getting
confused by the parameters passed in and trying to load the same file
twice?
What is perplexing -> how is it working well on one machine and not
working on another with exactly the same php.ini file.
Andy, thanks for your tips. I shall try to simulate the problem with
simple scripts as you said.
Cheers,
Saayan
Chung Leong wrote: <sa****@farfenc e.com> wrote in message news:11******** **************@ z14g2000cwz.goo glegroups.com.. . 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 Your require_once statements are kinda screwy. contents.php is
actually loading the home/functions.php, because relative paths are relative
to the running script (home/index.php) and not the file which contains the include/require statement.
.oO(Chung Leong) <sa****@farfen ce.com> wrote in message news:11******* *************** @z14g2000cwz.go oglegroups.com. ..
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 Your require_once statements are kinda screwy. contents.php is actually loading the home/functions.php
Nope. contents.php and functions.php are stored in the same directory,
so the following
require_once("f unctions.php");
works as expected. But I would write it as
require_once 'functions.php' ;
because relative paths are relative to the running script (home/index.php) and not the file which contains the include/require statement.
It makes a difference if the path in the include/require statement
starts with "../" or not.
Micha
Thanks. But other than the syntax, what is the semantic difference
between
require_once("f unctions.php");
and
require_once 'functions.php' ;
Issue is solved. Thanks a lot for all your replies.
There is nothing wrong with PHP w.r.t require_once. The problem is,
in machine 2:
..../home -> has a functions.php
..../home/secure/ -> also has a functions.php
machine 1:
has only one functions.php. In .../home/secure/
It is a source control issue.
Last month, the .php files were moved to /home/secure directory, but
the person moving the files forgot to delete the old files from /home
dir of the CVS server. So, in machine 2, when we synced with the CVS
server, - two copies of functions.php were checked out to the source
tree.
And I am suitably ashamed for not cross-checking the version control
before posting.
>There is nothing wrong with PHP w.r.t require_once. The problem is, in
machine 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... there is no functions.php in the 'home'
directory (which is where PHP is looking for the file).
.oO(sa****@farf ence.com) Thanks. But other than the syntax, what is the semantic difference between require_once(" functions.php") ;
and
require_once 'functions.php' ;
Nothing, except that a double quoted string forces the interpreter to
look for variables inside, while a single quoted string is used as-is.
The parentheses can be omitted because include/require are language
constructs, not functions (like echo/print for example). But that's
rather cosmetical or "personal preference", it makes no difference in
code execution.
Micha 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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |