Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with PHP

Status
Not open for further replies.

snakeeyes1978

Programmer
Jan 11, 2005
70
0
0
AU
I currently have an internal website up and running on Windows 2000 with IIS 4. I've installed PHP (5.1.4 – same version as previous) on a new Windows 2003 server with IIS 6. The setup of the boxes is exactly the same except for Windows and IIS versions.

Now when I run the php page it comes up:

Fatal error: Call to undefined function qualified_me() in C:\Webmodules\timetracker\lib\application.inc on line 39

Application.inc has this:

require("$ME = qualified_me();

Qualified me is DEFINITELY defined within stdlib.inc and is running correctly. I put an echo "A"; before the function definition and an echo "B"; after the function definition to prove the file was being loaded and it works correctly. I also tried to call the function immediately after it was defined and that worked.

Why, then, would it report an undefined function when it clearly is defined and called correctly with a require function?

I'm lost – any ideas?
 
why are you using the http protocol wrapper to require your libraries rather than a file system call? this could all stem from the way that .inc files are parsed by your webserver (although that would mean that the echo statements would be unlikely to work too).

it would also help if you showed us what was in stdlib.inc

are there any differences in the php.ini files between the two web servers?
 
I've tried using a file system call and that fails as well. The php.ini file on the new server was copied directly from the old server, as was the entire existing code. The ONLY difference between both computers is Windows 2000 and Windows 2003.
 
If what you say is true, then I'd suspect qualified_me(), but that seems remote.

Is qualified_me() making a call to something that might cause a permissions failure? Although, even if it did, I'd think you'd get different error.

Hmmmm... Interesting problem...


Darrell
 
It could be that you copied the ini file to the wrong location. You can check the used ini file by the output of the php_info() function. It could also be that Windows 2003 has a different firewall settings that prevents the file to be served, or the file simply is not in localhost's web root on the new server.

In any case, I would rewrite this call so that it uses the local filesystem instead of a web call.

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Does anything work ?
Can you knock together a little script that just does a phpinfo() and see what happens.Can you create a script that calls only qualify_me() to see what happens?
Can you call anything else in stdlib ?
Can you add a small test function into stdlib and call that ?
 
Ok. Now I have:

require("$ME = qualified_me();
die;

And i'm still getting:

Fatal error: Call to undefined function qualified_me() in C:\Webmodules\timetracker\lib\application.php

stdlib.php contains:
<?
function me() {
if (getenv("REQUEST_URI")) {
$me = getenv("REQUEST_URI");

} elseif (getenv("PATH_INFO")) {
$me = getenv("PATH_INFO");

} elseif ($_SERVER["PHP_SELF"]) {
$me = $_SERVER["PHP_SELF"];
}

return strip_querystring($me);
}

function qualified_me() {
/* like me() but returns a full URL */

$HTTPS = getenv("HTTPS");
$SERVER_PROTOCOL = getenv("SERVER_PROTOCOL");
$HTTP_HOST = getenv("HTTP_HOST");

$protocol = (isset($HTTPS) && $HTTPS == "on") ? " : " $url_prefix = "$protocol$HTTP_HOST";
return $url_prefix . me();
}

?>
 
Well, I have a work around. I basically took all the code in stdlib.inc and put it into application.inc instead and it works. Not exactly what I wanted to do, but it fixes the issue.

Let me explain in detail, in case someone else has this issue:

All PHP files reference "/localhost/application.php"
Application.php in turn referenced three different file:
stdlib.php
bsee.php
dblib.php

References from Application.php to those three files kept failing, as per above.

I took all the code from those three files and put it in to Application.php and everything worked. In other words, referencing a file from a referenced file failed.

Makes Application.php about 5000 lines long and very confusing, but it works.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top