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

Upgarding php4 to php5 leads to: PHP Fatal error: Call to undefined function ...

P: n/a
Hey there,

I just removed an elderly PHP4-Installation from my Windows-Box and
installed PHP 5.2.1. I used the PHP4-Module as local batchfile-
interpreter by

E:\ersDHCP>php ./extractLog.php

which was perfectly alright and worked well. But now PHP5 fails to run
the same script without any modification!

E:\ersDHCP>php ./extractLog.php
.... a bunch of php-code ...
PHP Fatal error: Call to undefined function getConnectionDetails() in
E:\ersDHCP\extractLog.php on line 21

PHP5 pretends failure to include a self-defined function
getConnectionDetails() that is stored in a file named
getConnectionDetails.php in the current directory just next to
extractLog.php. Using this script never has been a problem with PHP4
and I have no idea how to cope with this. Can anybody help me?

Thanks in advance

Christian

extractLog.php
=============

<?php

include_once('writeTextFileHeader.php');
include_once('dumpDhcpLogToTextFile.php');

include_once('writeMySqlCreateScript.php');
include_once('dumpDhcpLogToMySqlInsertScript.php') ;

include_once('dumpDhcpLogToMySqlServer.php');

include_once('traverseDirTree.php');
include_once('getArgValue.php');

include_once('getConnectionDetails.php');

set_time_limit(0);
error_reporting(E_ALL);

$version = "Version 3.1 vom 7.3.2007";

$parameter = &getConnectionDetails(false);

getConnectionDetails.php
====================
<?

include_once('getDefaultHead.php');
include_once('getDefaultFoot.php');

include_once('getConnectionDetailsFromIniFile.php' );

function &getConnectionDetails($dieOnFailure)
{

Mar 7 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
ja**@wispa.de wrote:
Hey there,

I just removed an elderly PHP4-Installation from my Windows-Box and
installed PHP 5.2.1. I used the PHP4-Module as local batchfile-
interpreter by

E:\ersDHCP>php ./extractLog.php

which was perfectly alright and worked well. But now PHP5 fails to run
the same script without any modification!

E:\ersDHCP>php ./extractLog.php
... a bunch of php-code ...
PHP Fatal error: Call to undefined function getConnectionDetails() in
E:\ersDHCP\extractLog.php on line 21

PHP5 pretends failure to include a self-defined function
getConnectionDetails() that is stored in a file named
getConnectionDetails.php in the current directory just next to
extractLog.php. Using this script never has been a problem with PHP4
and I have no idea how to cope with this. Can anybody help me?

Thanks in advance

Christian

extractLog.php
=============

<?php

include_once('writeTextFileHeader.php');
include_once('dumpDhcpLogToTextFile.php');

include_once('writeMySqlCreateScript.php');
include_once('dumpDhcpLogToMySqlInsertScript.php') ;

include_once('dumpDhcpLogToMySqlServer.php');

include_once('traverseDirTree.php');
include_once('getArgValue.php');

include_once('getConnectionDetails.php');

set_time_limit(0);
error_reporting(E_ALL);

$version = "Version 3.1 vom 7.3.2007";

$parameter = &getConnectionDetails(false);

getConnectionDetails.php
====================
<?

include_once('getDefaultHead.php');
include_once('getDefaultFoot.php');

include_once('getConnectionDetailsFromIniFile.php' );

function &getConnectionDetails($dieOnFailure)
{
Hi,

Hard to say.
I would start by replacing all include_once() by require_once() so you get
errors if something is wrong with finding the file (like permission,
another path than you expect, etc)

It is in general a good habbit to use require() instead of include because
the include will only fire a notice if the file is not found, and notices
can easily be disabled in php.ini (and often are).

If require() fails, you know where to start.

Regards,
Erwin Moller

Regards,
Erwin Moller
Mar 7 '07 #2

P: n/a
Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE but still
there is no more information about the failure. The syntax of all php-
files is ok and checked with php -l and I am totally stuck with this.
Any further ideas how to locate the source of this very short error-
message?

Regards,

Christian

Mar 7 '07 #3

P: n/a
Rik
<ja**@wispa.dewrote:
Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE but still
there is no more information about the failure. The syntax of all php-
files is ok and checked with php -l and I am totally stuck with this.
Any further ideas how to locate the source of this very short error-
message?

Yes, indeed. It dumps the source you say, and gives a php error message
about not being defined? This leds me to believe there is a reason your
file is not interpreted as PHP, while others are.

Then this snippet:
getConnectionDetails.php
====================
<?

Lets me say:
short_open_tag
<http://nl3.php.net/manual/en/ini.core.php>

You're advised to use <?php instead of <?, untill you've changed all your
files, set short_open_tag to on.
--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Mar 7 '07 #4

P: n/a
On Wed, 07 Mar 2007 18:03:51 +0100, Rik wrote:
<ja**@wispa.dewrote:
>Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE
I think you should set it to E_ALL or even E_STRICT (which fires php5
"compatibility" notices)

bye
--
NoWhereMan (e.v.)
-- http://www.nowhereland.it
-- http://flatpress.nowhereland.it
Mar 7 '07 #5

P: n/a
Rik
NoWhereMan <no**************@flashmailSPAM.comwrote:
On Wed, 07 Mar 2007 18:03:51 +0100, Rik wrote:
><ja**@wispa.dewrote:
>>Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE

I think you should set it to E_ALL or even E_STRICT (which fires php5
"compatibility" notices)
A total block of php not run/a function not being declared is hardly a
'compatibility'/notice problem... Allthough I agree using notices in
development/checking after updating is a real timesaver.

--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Mar 7 '07 #6

P: n/a
On Wed, 07 Mar 2007 19:22:42 +0100, Rik wrote:
NoWhereMan <no**************@flashmailSPAM.comwrote:
>On Wed, 07 Mar 2007 18:03:51 +0100, Rik wrote:
>><ja**@wispa.dewrote:

Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE

I think you should set it to E_ALL or even E_STRICT (which fires php5
"compatibility" notices)

A total block of php not run/a function not being declared is hardly a
'compatibility'/notice problem...
sure, so E_ALL should be fine
--
NoWhereMan (e.v.)
-- http://www.nowhereland.it
-- http://flatpress.nowhereland.it
Mar 7 '07 #7

P: n/a
ja**@wispa.de wrote:
Hey Erwin,

I replaced any include_once with require_once but did not notice any
change in PHP's behaviour - it still starts, dumps all the source and
terminates PHP Fatal error: Call to undefined function :-(

I even changed php.ini and set error_reporting = E_NOTICE but still
there is no more information about the failure. The syntax of all php-
files is ok and checked with php -l and I am totally stuck with this.
Any further ideas how to locate the source of this very short error-
message?

Regards,

Christian
Hi Christian,

I had a similar problem a week ago, and I now see how it could be relevant
to your problem too. Maybe they are the same.

An app I made works great. Of course. ;-)
Then somebody wanted to install it on his own laptop, for testingpurposes,
and as it turned out he couldn't get it running.
My app failed on a call to an undefined function.
Since I was sure that function existed, I checked with him the include_path
and stuff like that. All seemed OK.

The most starnge thing was this:
- I asked him to put an
echo "TESTING!";
at the end of the includefile, and THAT did appear on the screen.
But NONE of the functions inside the includefile were found.

I was awestuck, so I jumped into my car and visited him, because actually I
couldn't believe this was happening, and I expected he made some stupid
mistake.
After some edditing in the file, all of a sudden all functions were found,
and things kept working.
Because we had no clue WHAT we changed that could be remotely important, we
placed back the old, original file, but still the problem didn't return.
This was on XP with PHP5.
Very frustrating.

At first I thought the guy didn't get the files in right, with ftp, and
screwed up some end-of-lines somewhere, but placing back the original file
didn't give the problem again.
So I am shooting in the dark with my end-of-line hypothesis.

I am unsure if my story is relevant to your situation, but you might try to
do the same: edit the file e little, safe it, and see if it works.
I know how stupid it sounds, but give it a shot.

Regards,
Erwin Moller
Mar 8 '07 #8

P: n/a
java wrote:
dumps all the source
Rik hit the nail on the head: short_open_tags.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 8 '07 #9

P: n/a
java wrote:
dumps all the source

Rik hit the nail on the head: short_open_tags.
Excuse me posting this late: short_open_tags did the trick, thanks
alot!

Mar 8 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.