PDA

View Full Version : Undefined Function Error



scuff
11-03-2009, 01:58 AM
I am hoping someone else has ran into this before....

I have just added another domain to my existing server and have the basic construction done and online. As I am adding some functionality to the pages I have run into a problem. I created a .php page that will contain most of the functions required on this page and have used the "require_once()" to include it. However I keep getting function undefined errors. I though that maybe the file was not included properly so I went in to it and added a print statement to verify that i was added and sure enough it print to the screen so I now the file is there but it can not use the functions in there....Any ideas. Is there something the needs to be setup on the new domain to access external functions? I have never had this problem before.

Any sugestions or help would be greatly appreciated.

felgall
11-03-2009, 02:20 AM
What you have described can't happen and therefore what you actually have must differ in some way from what you have described but as you haven't provided any code it is impossible to say how it differs. Of course if you could see what the difference was you wouldn't need to ask for help.

BeedaCred
11-03-2009, 02:27 AM
Inside the admin, when i click on the Members tab I get this error and nothing happens:

Fatal error: Call to undefined function: imap_open in /<myserverpath>/simple/admin/members.php on line 145

Any ideas? Fresh install, followed the directions..

Thank you

scuff
11-03-2009, 02:54 AM
It is pretty hard to show code without showing too much....Hopefully this will be enough.

my index file: section of code:

<? require_once('http://www.mydomain.com/phpincludes/mainfunctions.php'); ?>

...
<td id="menu" align="left" valign="top">
<table>
<tr><td id="sidemenu">&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><? showrandom(); ?></td></tr>
</table>
</td>
<td id="main" align="center" valign="top">
...



my mainfunctions.php file section:
<?PHP
function showrandom() {
//code is in here
}

?>

felgall
11-03-2009, 11:43 AM
The only thing I can see in that which might be the problem is that <?PHP should be <?php

scuff
11-03-2009, 10:20 PM
The only thing I can see in that which might be the problem is that <?PHP should be <?php

I tried changing to <?php and it did not change so I created a new file and re-wrote the function in it. I also changed the name thinking there may be a reserved word or something like that. Still getting the same error.

Is there anything that you know of that could be on the server end or maybe in the php.ini file that could tell the scrips not to use external functions? Just a thought...I am at a loss.

Thanks

farcaster
11-03-2009, 11:17 PM
Just for troubleshooting purposes...

Instead of using the include/require statement, why not place your entire function script into the page that is using it and having the problems. See if the problem still exists. If it does, then obviously it's your script. If it works fine, then you would start looking elsewhere.

scuff
11-18-2009, 02:20 AM
Just for troubleshooting purposes...

Instead of using the include/require statement, why not place your entire function script into the page that is using it and having the problems. See if the problem still exists. If it does, then obviously it's your script. If it works fine, then you would start looking elsewhere.

sorry, have not checked back in a while.
I did do that and temporarily that is what i am doing to get the page going as the script runs fine when it is on the same page. as soon as a place it in a separate .php file, then it will not find it.